mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
fix conferences info in call history
This commit is contained in:
parent
8ba61d800f
commit
552f7acb46
7 changed files with 53 additions and 20 deletions
|
|
@ -46,12 +46,21 @@ CallHistoryCore::CallHistoryCore(const std::shared_ptr<linphone::CallLog> &callL
|
|||
|
||||
auto addr = callLog->getRemoteAddress()->clone();
|
||||
addr->clean();
|
||||
mRemoteAddress = Utils::coreStringToAppString(addr->asStringUriOnly());
|
||||
// mRemoteAddress->clean();
|
||||
mStatus = LinphoneEnums::fromLinphone(callLog->getStatus());
|
||||
mDate = QDateTime::fromMSecsSinceEpoch(callLog->getStartDate() * 1000);
|
||||
mIsOutgoing = callLog->getDir() == linphone::Call::Dir::Outgoing;
|
||||
mDuration = QString::number(callLog->getDuration());
|
||||
mIsConference = callLog->wasConference();
|
||||
if (mIsConference) {
|
||||
auto confinfo = callLog->getConferenceInfo();
|
||||
confinfo->getSubject();
|
||||
mRemoteAddress = Utils::coreStringToAppString(confinfo->getUri()->asStringUriOnly());
|
||||
mDisplayName = Utils::coreStringToAppString(confinfo->getSubject());
|
||||
} else {
|
||||
mRemoteAddress = Utils::coreStringToAppString(addr->asStringUriOnly());
|
||||
mDisplayName = ToolModel::getDisplayName(Utils::coreStringToAppString(addr->asStringUriOnly()));
|
||||
}
|
||||
}
|
||||
|
||||
CallHistoryCore::~CallHistoryCore() {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,10 @@ class CallHistoryModel;
|
|||
class CallHistoryCore : public QObject, public AbstractObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString displayName MEMBER mDisplayName CONSTANT)
|
||||
Q_PROPERTY(QString remoteAddress MEMBER mRemoteAddress CONSTANT)
|
||||
Q_PROPERTY(bool isOutgoing MEMBER mIsOutgoing CONSTANT)
|
||||
Q_PROPERTY(bool isConference MEMBER mIsConference CONSTANT)
|
||||
Q_PROPERTY(QDateTime date MEMBER mDate CONSTANT)
|
||||
Q_PROPERTY(LinphoneEnums::CallStatus status MEMBER mStatus CONSTANT)
|
||||
Q_PROPERTY(QString duration READ getDuration WRITE setDuration NOTIFY durationChanged)
|
||||
|
|
@ -52,8 +54,10 @@ public:
|
|||
Q_INVOKABLE void remove();
|
||||
|
||||
QString mRemoteAddress;
|
||||
QString mDisplayName;
|
||||
QDateTime mDate;
|
||||
bool mIsOutgoing;
|
||||
bool mIsConference;
|
||||
LinphoneEnums::CallStatus mStatus;
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "core/call/CallGui.hpp"
|
||||
#include "core/conference/ConferenceInfoCore.hpp"
|
||||
#include "core/conference/ConferenceInfoGui.hpp"
|
||||
#include "core/friend/FriendGui.hpp"
|
||||
#include "core/path/Paths.hpp"
|
||||
#include "model/object/VariantObject.hpp"
|
||||
#include "model/tool/ToolModel.hpp"
|
||||
|
|
@ -298,6 +299,22 @@ QString Utils::findAvatarByAddress(const QString &address) {
|
|||
return avatar;
|
||||
}
|
||||
|
||||
VariantObject *Utils::findFriendByAddress(const QString &address) {
|
||||
VariantObject *data = new VariantObject();
|
||||
if (!data) return nullptr;
|
||||
data->makeRequest([address]() {
|
||||
auto defaultFriendList = CoreModel::getInstance()->getCore()->getDefaultFriendList();
|
||||
if (!defaultFriendList) return QVariant();
|
||||
auto linphoneAddr = ToolModel::interpretUrl(address);
|
||||
auto linFriend = CoreModel::getInstance()->getCore()->findFriend(linphoneAddr);
|
||||
if (!linFriend) return QVariant();
|
||||
auto friendCore = FriendCore::create(linFriend);
|
||||
return QVariant::fromValue(new FriendGui(friendCore));
|
||||
});
|
||||
data->requestValue();
|
||||
return data;
|
||||
}
|
||||
|
||||
QString Utils::generateSavedFilename(const QString &from, const QString &to) {
|
||||
auto escape = [](const QString &str) {
|
||||
constexpr char ReservedCharacters[] = "[<|>|:|\"|/|\\\\|\\?|\\*|\\+|\\||_|-]+";
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ public:
|
|||
Q_INVOKABLE static QDateTime addYears(QDateTime date, int years);
|
||||
Q_INVOKABLE static QString generateLinphoneSipAddress(const QString &uri);
|
||||
Q_INVOKABLE static QString findAvatarByAddress(const QString &address);
|
||||
Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address);
|
||||
static QString generateSavedFilename(const QString &from, const QString &to);
|
||||
Q_INVOKABLE static bool isMe(const QString &address);
|
||||
Q_INVOKABLE static bool isLocal(const QString &address);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ ColumnLayout {
|
|||
property string contactAddress: contact && contact.core.defaultAddress || ""
|
||||
property string contactName: contact && contact.core.displayName || ""
|
||||
|
||||
property bool addressVisible: true
|
||||
|
||||
property alias buttonContent: rightButton.data
|
||||
property alias detailContent: detailControl.data
|
||||
|
||||
|
|
@ -50,7 +48,7 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: mainItem.implicitWidth
|
||||
Layout.preferredWidth: 360 * DefaultStyle.dp
|
||||
Layout.preferredHeight: detailAvatar.height
|
||||
// Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
|
@ -73,11 +71,15 @@ ColumnLayout {
|
|||
}
|
||||
ColumnLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
// Layout.fillWidth: true
|
||||
Layout.preferredWidth: 360 * DefaultStyle.dp
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WrapAnywhere
|
||||
elide: Text.ElideRight
|
||||
text: mainItem.contactName
|
||||
maximumLineCount: 1
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
|
|
@ -85,11 +87,10 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
Text {
|
||||
id: contactAddress
|
||||
property var mode : contact ? contact.core.consolidatedPresence : -1
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: mainItem.addressVisible
|
||||
visible: mainItem.contact
|
||||
text: mode === LinphoneEnums.ConsolidatedPresence.Online
|
||||
? qsTr("En ligne")
|
||||
: mode === LinphoneEnums.ConsolidatedPresence.Busy
|
||||
|
|
@ -126,8 +127,7 @@ ColumnLayout {
|
|||
button.icon.source: AppIcons.phone
|
||||
label: qsTr("Appel")
|
||||
button.onClicked: {
|
||||
var addr = UtilsCpp.generateLinphoneSipAddress(mainItem.contactAddress)
|
||||
UtilsCpp.createCall(addr)
|
||||
UtilsCpp.createCall(mainItem.contactAddress)
|
||||
}
|
||||
}
|
||||
LabelButton {
|
||||
|
|
@ -150,8 +150,7 @@ ColumnLayout {
|
|||
button.icon.source: AppIcons.videoCamera
|
||||
label: qsTr("Appel Video")
|
||||
button.onClicked: {
|
||||
var addr = UtilsCpp.generateLinphoneSipAddress(mainItem.contactAddress)
|
||||
UtilsCpp.createCall(addr, {'localVideoEnabled':true})
|
||||
UtilsCpp.createCall(mainItem.contactAddress, {'localVideoEnabled':true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ AbstractMainPage {
|
|||
else rightPanelStackView.replace(emptySelection, Control.StackView.Immediate)
|
||||
}
|
||||
rightPanelStackView.initialItem: emptySelection
|
||||
rightPanelStackView.width: 360 * DefaultStyle.dp
|
||||
|
||||
onNoItemButtonPressed: goToNewCall()
|
||||
|
||||
|
|
@ -48,6 +49,10 @@ AbstractMainPage {
|
|||
listStackView.push(newCallItem)
|
||||
}
|
||||
|
||||
function createCall(addr) {
|
||||
UtilsCpp.createCall(addr)
|
||||
}
|
||||
|
||||
Dialog {
|
||||
id: deleteHistoryPopup
|
||||
width: 278 * DefaultStyle.dp
|
||||
|
|
@ -92,7 +97,7 @@ AbstractMainPage {
|
|||
width: parent.width
|
||||
height: parent.height
|
||||
onLaunchCall: {
|
||||
UtilsCpp.createCall(searchBar.text + "@sip.linphone.org")
|
||||
mainItem.createCall(UtilsCpp.generateLinphoneSipAddress(searchBar.text))
|
||||
// TODO : auto completion instead of sip linphone
|
||||
}
|
||||
}
|
||||
|
|
@ -248,8 +253,7 @@ AbstractMainPage {
|
|||
id: friendAddress
|
||||
Layout.fillWidth: true
|
||||
maximumLineCount: 1
|
||||
property var remoteAddress: modelData ? UtilsCpp.getDisplayName(modelData.core.remoteAddress) : null
|
||||
text: remoteAddress ? remoteAddress.value : ""
|
||||
text: modelData.core.displayName
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
|
|
@ -311,8 +315,7 @@ AbstractMainPage {
|
|||
icon.width: 24 * DefaultStyle.dp
|
||||
icon.height: 24 * DefaultStyle.dp
|
||||
onClicked: {
|
||||
var addr = UtilsCpp.generateLinphoneSipAddress(modelData.core.remoteAddress)
|
||||
UtilsCpp.createCall(addr)
|
||||
mainItem.createCall(modelData.core.remoteAddress)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -405,7 +408,7 @@ AbstractMainPage {
|
|||
searchBarColor: DefaultStyle.grey_100
|
||||
|
||||
onCallButtonPressed: (address) => {
|
||||
UtilsCpp.createCall(UtilsCpp.generateLinphoneSipAddress(address))
|
||||
mainItem.createCall(address)
|
||||
// var window = UtilsCpp.getCallsWindow()
|
||||
}
|
||||
onGroupCallCreationRequested: {
|
||||
|
|
@ -508,9 +511,10 @@ AbstractMainPage {
|
|||
ContactLayout {
|
||||
id: contactDetail
|
||||
visible: mainItem.selectedRowHistoryGui != undefined
|
||||
property var remoteName: mainItem.selectedRowHistoryGui ? UtilsCpp.getDisplayName(mainItem.selectedRowHistoryGui.core.remoteAddress) : null
|
||||
property var contactObj: UtilsCpp.findFriendByAddress(contactAddress)
|
||||
contact: contactObj ? contactObj.value : null
|
||||
contactAddress: mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress || ""
|
||||
contactName: remoteName ? remoteName.value : ""
|
||||
contactName: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.displayName : ""
|
||||
anchors.top: rightPanelStackView.top
|
||||
anchors.bottom: rightPanelStackView.bottom
|
||||
anchors.topMargin: 45 * DefaultStyle.dp
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ AbstractMainPage {
|
|||
Control.ScrollView {
|
||||
id: listLayout
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 25 * DefaultStyle.dp
|
||||
contentWidth: width
|
||||
contentHeight: content.height
|
||||
clip: true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue