cancelled conf ui

This commit is contained in:
Gaelle Braud 2024-11-06 14:34:08 +01:00
parent f68327bcf6
commit 94dd384129
7 changed files with 50 additions and 17 deletions

View file

@ -175,8 +175,7 @@ private:
QVariantList mParticipants;
QSharedPointer<TimeZoneModel> mTimeZoneModel;
LinphoneEnums::ConferenceSchedulerState mConferenceSchedulerState;
LinphoneEnums::ConferenceInfoState mConferenceInfoState =
LinphoneEnums::ConferenceInfoState::ConferenceInfoStateNew;
LinphoneEnums::ConferenceInfoState mConferenceInfoState = LinphoneEnums::ConferenceInfoState::New;
bool mHaveModel = false;
bool mIsScheduled;
bool mIsEnded = false;

View file

@ -63,7 +63,16 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
items->push_back(nullptr); // Add Dummy conference for today
for (auto conferenceInfo : conferenceInfos) {
auto confInfoCore = build(conferenceInfo);
if (confInfoCore) items->push_back(confInfoCore);
// Cancelled conference organized ourself me must be hidden
if (conferenceInfo->getState() == linphone::ConferenceInfo::State::Cancelled) {
auto myAddress = defaultAccount->getContactAddress();
if (myAddress && myAddress->weakEqual(conferenceInfo->getOrganizer())) continue;
}
if (confInfoCore) {
qDebug() << log().arg("Add conf") << confInfoCore->getSubject() << "with state"
<< confInfoCore->getConferenceInfoState();
items->push_back(confInfoCore);
}
}
mCoreModelConnection->invokeToCore([this, items]() {
mustBeInMainThread(getClassName());
@ -86,7 +95,23 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
});
});
mCoreModelConnection->makeConnectToModel(&CoreModel::defaultAccountChanged, &ConferenceInfoList::lUpdate);
// This is needed because account does not have a contact address until
// it is connected, so we can't verify if it is the organizer of a deleted
// conference (which must hidden)
auto connectModel = [this] {
mCoreModelConnection->invokeToModel([this]() {
if (mCurrentAccountCore) disconnect(mCurrentAccountCore.get());
auto defaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
if (defaultAccount) {
mCurrentAccountCore = AccountCore::create(defaultAccount);
connect(mCurrentAccountCore.get(), &AccountCore::registrationStateChanged, this,
&ConferenceInfoList::lUpdate);
}
});
};
mCoreModelConnection->makeConnectToModel(&CoreModel::defaultAccountChanged, connectModel);
connectModel();
mCoreModelConnection->makeConnectToModel(&CoreModel::conferenceInfoReceived, &ConferenceInfoList::lUpdate);
mCoreModelConnection->makeConnectToModel(
&CoreModel::conferenceInfoCreated, [this](const std::shared_ptr<linphone::ConferenceInfo> &confInfo) {

View file

@ -28,6 +28,7 @@
class CoreModel;
class ConferenceInfoCore;
class AccountCore;
class ConferenceInfoList : public ListProxy, public AbstractObject {
Q_OBJECT
@ -65,6 +66,7 @@ private:
QSharedPointer<SafeConnection<ConferenceInfoList, CoreModel>> mCoreModelConnection;
std::shared_ptr<CoreModel> mCoreModel;
QSharedPointer<ConferenceInfoCore> mLastConfInfoInserted;
QSharedPointer<AccountCore> mCurrentAccountCore;
bool mHaveCurrentDate = false;
int mCurrentDateIndex = -1;
DECLARE_ABSTRACT_OBJECT

View file

@ -221,10 +221,10 @@ Q_ENUM_NS(ConferenceLayout)
linphone::Conference::Layout toLinphone(const LinphoneEnums::ConferenceLayout &layout);
LinphoneEnums::ConferenceLayout fromLinphone(const linphone::Conference::Layout &layout);
enum ConferenceInfoState {
ConferenceInfoStateNew = int(linphone::ConferenceInfo::State::New),
ConferenceInfoStateUpdated = int(linphone::ConferenceInfo::State::Updated),
ConferenceInfoStateCancelled = int(linphone::ConferenceInfo::State::Cancelled)
enum class ConferenceInfoState {
New = int(linphone::ConferenceInfo::State::New),
Updated = int(linphone::ConferenceInfo::State::Updated),
Cancelled = int(linphone::ConferenceInfo::State::Cancelled)
};
Q_ENUM_NS(ConferenceInfoState)

View file

@ -4,7 +4,7 @@ import QtQuick.Effects
import Linphone
import QtQml
import UtilsCpp 1.0
import UtilsCpp
ListView {
id: mainItem
@ -68,6 +68,7 @@ ListView {
id: itemDelegate
height: 63 * DefaultStyle.dp + topOffset
width: mainItem.width
enabled: !isCanceled
property var previousItem : mainItem.model.count > 0 && index > 0 ? mainItem.model.getAt(index-1) : null
property var dateTime: !!$modelData && $modelData.core.haveModel ? $modelData.core.dateTime : UtilsCpp.getCurrentDateTime()
property string day : UtilsCpp.toDateDayNameString(dateTime)
@ -76,8 +77,9 @@ ListView {
property bool isFirst : ListView.previousSection !== ListView.section
property int topOffset: (dateDay.visible && !isFirst? 8 * DefaultStyle.dp : 0)
property var endDateTime: $modelData ? $modelData.core.endDateTime : UtilsCpp.getCurrentDateTime()
property var haveModel: $modelData && $modelData.core.haveModel || false
property var haveModel: !!$modelData && $modelData != undefined && $modelData.core.haveModel || false
property bool isCanceled: $modelData.core.state === LinphoneEnums.ConferenceInfoState.Cancelled
RowLayout{
@ -167,8 +169,8 @@ ListView {
}
}
Text {
text: UtilsCpp.toDateHourString(dateTime) + " - " + UtilsCpp.toDateHourString(endDateTime)
color: DefaultStyle.main2_500main
text: itemDelegate.isCanceled ? qsTr("Réunion annulée") : UtilsCpp.toDateHourString(dateTime) + " - " + UtilsCpp.toDateHourString(endDateTime)
color: itemDelegate.isCanceled ? DefaultStyle.danger_500main : DefaultStyle.main2_500main
font {
pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp

View file

@ -400,9 +400,11 @@ Item {
Repeater {
model: accountProxy
Connections {
target: modelData.core
onMwiChanged: updateCumulatedMwi()
delegate: Item {
Connections {
target: modelData.core
onMwiChanged: updateCumulatedMwi()
}
}
}

View file

@ -587,6 +587,7 @@ AbstractMainPage {
contentImageColor: DefaultStyle.danger_500main
inversedColors: true
property var isMeObj: UtilsCpp.isMe(mainItem.selectedConference?.core.organizerAddress)
property bool canCancel: isMeObj && isMeObj.value && mainItem.selectedConference.core.state !== LinphoneEnums.ConferenceInfoState.Cancelled
icon.source: AppIcons.trashCan
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
@ -597,7 +598,7 @@ AbstractMainPage {
onClicked: {
if (mainItem.selectedConference) {
cancelAndDeleteConfDialog.cancel = isMeObj? isMeObj.value : false
cancelAndDeleteConfDialog.cancel = canCancel
cancelAndDeleteConfDialog.open()
// mainItem.contactDeletionRequested(mainItem.selectedConference)
deletePopup.close()
@ -754,6 +755,7 @@ AbstractMainPage {
}
}
Section {
visible: participantList.count > 0
content: RowLayout {
Layout.preferredHeight: participantList.height
width: 393 * DefaultStyle.dp
@ -802,6 +804,7 @@ AbstractMainPage {
}
Button {
id: joinButton
visible: mainItem.selectedConference && mainItem.selectedConference.core.state !== LinphoneEnums.ConferenceInfoState.Cancelled
Layout.fillWidth: true
text: qsTr("Rejoindre la réunion")
topPadding: 11 * DefaultStyle.dp