fix meeting creation
fix wrong thread conference info write from model fix #LINQT-1563 update dummy item on conf info date modif fix variant object ownership fix initaldisplayitems
This commit is contained in:
parent
60182a8797
commit
a4b7951b22
5 changed files with 33 additions and 27 deletions
|
|
@ -86,7 +86,6 @@ ConferenceInfoCore::ConferenceInfoCore(std::shared_ptr<linphone::ConferenceInfo>
|
|||
for (auto item : conferenceInfo->getParticipantInfos()) {
|
||||
QVariantMap participant;
|
||||
auto address = item->getAddress();
|
||||
participant["displayName"] = ToolModel::getDisplayName(address);
|
||||
participant["address"] = Utils::coreStringToAppString(address->asStringUriOnly());
|
||||
participant["role"] = (int)LinphoneEnums::fromLinphone(item->getRole());
|
||||
mParticipants.append(participant);
|
||||
|
|
@ -221,6 +220,7 @@ void ConferenceInfoCore::setSelf(QSharedPointer<ConferenceInfoCore> me) {
|
|||
mConfInfoModelConnection->makeConnectToModel(
|
||||
&ConferenceInfoModel::invitationsSent,
|
||||
[this](const std::list<std::shared_ptr<linphone::Address>> &failedInvitations) {});
|
||||
|
||||
} else { // Create
|
||||
mCoreModelConnection = QSharedPointer<SafeConnection<ConferenceInfoCore, CoreModel>>(
|
||||
new SafeConnection<ConferenceInfoCore, CoreModel>(me, CoreModel::getInstance()), &QObject::deleteLater);
|
||||
|
|
@ -382,13 +382,12 @@ int ConferenceInfoCore::getParticipantCount() const {
|
|||
}
|
||||
|
||||
void ConferenceInfoCore::addParticipant(const QString &address) {
|
||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
||||
for (auto &participant : mParticipants) {
|
||||
auto map = participant.toMap();
|
||||
if (map["address"].toString() == address) return;
|
||||
}
|
||||
QVariantMap participant;
|
||||
auto displayNameObj = Utils::getDisplayName(address);
|
||||
participant["displayNameObj"] = QVariant::fromValue(displayNameObj);
|
||||
participant["address"] = address;
|
||||
participant["role"] = (int)LinphoneEnums::ParticipantRole::Listener;
|
||||
mParticipants.append(participant);
|
||||
|
|
@ -396,6 +395,7 @@ void ConferenceInfoCore::addParticipant(const QString &address) {
|
|||
}
|
||||
|
||||
void ConferenceInfoCore::addParticipants(const QStringList &addresses) {
|
||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
||||
bool addressAdded = false;
|
||||
for (auto &address : addresses) {
|
||||
auto found = std::find_if(mParticipants.begin(), mParticipants.end(), [address](QVariant participant) {
|
||||
|
|
@ -403,8 +403,6 @@ void ConferenceInfoCore::addParticipants(const QStringList &addresses) {
|
|||
});
|
||||
if (found == mParticipants.end()) {
|
||||
QVariantMap participant;
|
||||
auto displayNameObj = Utils::getDisplayName(address);
|
||||
participant["displayNameObj"] = QVariant::fromValue(displayNameObj);
|
||||
participant["address"] = address;
|
||||
participant["role"] = (int)LinphoneEnums::ParticipantRole::Listener;
|
||||
mParticipants.append(participant);
|
||||
|
|
@ -446,12 +444,10 @@ void ConferenceInfoCore::resetParticipants(QVariantList participants) {
|
|||
}
|
||||
|
||||
void ConferenceInfoCore::resetParticipants(const QStringList &adresses) {
|
||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
||||
mParticipants.clear();
|
||||
for (auto &address : adresses) {
|
||||
QVariantMap participant;
|
||||
QString name;
|
||||
auto displayNameObj = Utils::getDisplayName(address);
|
||||
participant["displayNameObj"] = QVariant::fromValue(displayNameObj);
|
||||
participant["address"] = address;
|
||||
participant["role"] = (int)LinphoneEnums::ParticipantRole::Listener;
|
||||
mParticipants.append(participant);
|
||||
|
|
@ -522,17 +518,25 @@ void ConferenceInfoCore::setConferenceSchedulerState(LinphoneEnums::ConferenceSc
|
|||
|
||||
void ConferenceInfoCore::writeFromModel(const std::shared_ptr<ConferenceInfoModel> &model) {
|
||||
mustBeInLinphoneThread(getClassName() + "::writeFromModel()");
|
||||
setDateTime(model->getDateTime());
|
||||
setDuration(model->getDuration());
|
||||
setSubject(model->getSubject());
|
||||
setOrganizerName(model->getOrganizerName());
|
||||
setOrganizerAddress(model->getOrganizerAddress());
|
||||
setDescription(model->getDescription());
|
||||
mDateTime = model->getDateTime();
|
||||
mDuration = model->getDuration();
|
||||
mSubject = model->getSubject();
|
||||
mOrganizerName = model->getOrganizerName();
|
||||
mOrganizerAddress = model->getOrganizerAddress();
|
||||
mDescription = model->getDescription();
|
||||
mParticipants.clear();
|
||||
QStringList participantAddresses;
|
||||
for (auto &infos : model->getParticipantInfos()) {
|
||||
participantAddresses.append(Utils::coreStringToAppString(infos->getAddress()->asStringUriOnly()));
|
||||
}
|
||||
resetParticipants(participantAddresses);
|
||||
mConfInfoModelConnection->invokeToModel([this, participantAddresses]() { // Copy values to avoid concurrency
|
||||
for (auto &address : participantAddresses) {
|
||||
QVariantMap participant;
|
||||
participant["address"] = address;
|
||||
participant["role"] = (int)LinphoneEnums::ParticipantRole::Listener;
|
||||
mParticipants.append(participant);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void ConferenceInfoCore::writeIntoModel(std::shared_ptr<ConferenceInfoModel> model) {
|
||||
|
|
|
|||
|
|
@ -227,6 +227,7 @@ void ConferenceInfoList::connectItem(QSharedPointer<ConferenceInfoCore> confInfo
|
|||
int i = -1;
|
||||
get(confInfoCore.get(), &i);
|
||||
if (i != -1) {
|
||||
updateHaveCurrentDate();
|
||||
auto modelIndex = index(i);
|
||||
emit confInfoUpdated(confInfoCore);
|
||||
emit dataChanged(modelIndex, modelIndex);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ ListView {
|
|||
id: confInfoProxy
|
||||
filterText: searchBarText
|
||||
filterType: ConferenceInfoProxy.None
|
||||
initialDisplayItems: 2 * mainItem.height / (63 * DefaultStyle.dp)
|
||||
initialDisplayItems: Math.max(20, 2 * mainItem.height / (63 * DefaultStyle.dp))
|
||||
displayItemsStep: initialDisplayItems/2
|
||||
function selectData(confInfoGui){
|
||||
mainItem.currentIndex = loadUntil(confInfoGui)
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ FocusScope {
|
|||
property bool isCreation
|
||||
property ConferenceInfoGui conferenceInfoGui
|
||||
signal addParticipantsRequested()
|
||||
signal returnRequested()
|
||||
signal saveSucceed(bool isCreation)
|
||||
|
||||
ColumnLayout {
|
||||
id: formLayout
|
||||
|
|
@ -287,7 +285,8 @@ FocusScope {
|
|||
_address: modelData.address
|
||||
}
|
||||
Text {
|
||||
text: modelData.displayName || modelData.displayNameObj?.value || ""
|
||||
property var displayNameObj: UtilsCpp.getDisplayName(modelData.address)
|
||||
text: displayNameObj?.value || ""
|
||||
font.pixelSize: 14 * DefaultStyle.dp
|
||||
font.capitalization: Font.Capitalize
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ AbstractMainPage {
|
|||
|
||||
onSelectedConferenceChanged: {
|
||||
// While a conference is being edited, we need to stay on the edit page
|
||||
if (overridenRightPanelStackView.currentItem && overridenRightPanelStackView.currentItem.objectName === "editConf") return
|
||||
if (overridenRightPanelStackView.currentItem && (overridenRightPanelStackView.currentItem.objectName === "editConf" || overridenRightPanelStackView.currentItem.objectName === "createConf")) return
|
||||
overridenRightPanelStackView.clear()
|
||||
if (selectedConference && selectedConference.core && selectedConference.core.haveModel) {
|
||||
if (!overridenRightPanelStackView.currentItem || overridenRightPanelStackView.currentItem != meetingDetail) overridenRightPanelStackView.replace(meetingDetail, Control.StackView.Immediate)
|
||||
|
|
@ -212,6 +212,7 @@ AbstractMainPage {
|
|||
id: createConf
|
||||
FocusScope{
|
||||
id: createConfLayout
|
||||
objectName: "createConf"
|
||||
property ConferenceInfoGui conferenceInfoGui
|
||||
property bool isCreation
|
||||
ColumnLayout {
|
||||
|
|
@ -278,7 +279,12 @@ AbstractMainPage {
|
|||
target: meetingSetup.conferenceInfoGui ? meetingSetup.conferenceInfoGui.core : null
|
||||
function onConferenceSchedulerStateChanged() {
|
||||
var mainWin = UtilsCpp.getMainWindow()
|
||||
if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending
|
||||
if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) {
|
||||
leftPanelStackView.pop()
|
||||
UtilsCpp.showInformationPopup(qsTr("Nouvelle réunion"), qsTr("Réunion planifiée avec succès"), true)
|
||||
mainWindow.closeLoadingPopup()
|
||||
}
|
||||
else if (meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending
|
||||
|| meetingSetup.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) {
|
||||
mainWin.showLoadingPopup(qsTr("Création de la réunion en cours..."), true, function () {
|
||||
leftPanelStackView.pop()
|
||||
|
|
@ -296,11 +302,6 @@ AbstractMainPage {
|
|||
mainWin.closeLoadingPopup()
|
||||
}
|
||||
}
|
||||
onSaveSucceed: {
|
||||
leftPanelStackView.pop()
|
||||
UtilsCpp.showInformationPopup(qsTr("Nouvelle réunion"), qsTr("Réunion planifiée avec succès"), true)
|
||||
mainWindow.closeLoadingPopup()
|
||||
}
|
||||
onAddParticipantsRequested: {
|
||||
leftPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": leftPanelStackView})
|
||||
}
|
||||
|
|
@ -763,7 +764,8 @@ AbstractMainPage {
|
|||
_address: modelData.address
|
||||
}
|
||||
Text {
|
||||
text: modelData.displayName || modelData.displayNameObj?.value || ""
|
||||
property var displayNameObj: UtilsCpp.getDisplayName(modelData.address)
|
||||
text: displayNameObj?.value || ""
|
||||
maximumLineCount: 1
|
||||
Layout.fillWidth: true
|
||||
font {
|
||||
|
|
|
|||
Loading…
Reference in a new issue