mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
fix #LINQT-1439 select new conf on created
This commit is contained in:
parent
733702b781
commit
3863365863
10 changed files with 35 additions and 48 deletions
|
|
@ -205,9 +205,10 @@ void ConferenceInfoCore::setSelf(QSharedPointer<ConferenceInfoCore> me) {
|
|||
setConferenceInfoState(infoState);
|
||||
if (state == LinphoneEnums::ConferenceSchedulerState::Ready) {
|
||||
setUri(uri);
|
||||
mConfInfoModelConnection->invokeToModel([this, uri] {
|
||||
CoreModel::getInstance()->conferenceInfoCreated(
|
||||
mConferenceInfoModel->getConferenceInfo());
|
||||
mConfInfoModelConnection->invokeToModel([this, uri, infoState] {
|
||||
if (infoState == LinphoneEnums::ConferenceInfoState::New)
|
||||
emit CoreModel::getInstance()->conferenceInfoCreated(
|
||||
mConferenceInfoModel->getConferenceInfo());
|
||||
});
|
||||
}
|
||||
setConferenceSchedulerState(state);
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
|||
defaultAccount->getConferenceInformationList();
|
||||
items->push_back(nullptr); // Add Dummy conference for today
|
||||
for (auto conferenceInfo : conferenceInfos) {
|
||||
auto confInfoCore = build(conferenceInfo);
|
||||
// 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;
|
||||
}
|
||||
auto confInfoCore = build(conferenceInfo);
|
||||
// Cancelled conference organized ourself me must be hidden
|
||||
if (confInfoCore) {
|
||||
qDebug() << log().arg("Add conf") << confInfoCore->getSubject() << "with state"
|
||||
<< confInfoCore->getConferenceInfoState();
|
||||
|
|
@ -85,8 +85,6 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
|||
// TODO : uncomment when linphone conference scheduler updated
|
||||
// and model returns the scheduler conferenceInfo uri
|
||||
index = findConfInfoIndexByUri(mLastConfInfoInserted->getUri());
|
||||
// int index2;
|
||||
// get(mLastConfInfoInserted.get(), &index2);
|
||||
if (index != -1) setCurrentDateIndex(index);
|
||||
else setCurrentDateIndex(mHaveCurrentDate ? currentDateIndex : currentDateIndex + 1);
|
||||
mLastConfInfoInserted = nullptr;
|
||||
|
|
@ -113,7 +111,6 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
|||
mCoreModelConnection->makeConnectToModel(&CoreModel::defaultAccountChanged, connectModel);
|
||||
connectModel();
|
||||
|
||||
mCoreModelConnection->makeConnectToModel(&CoreModel::conferenceInfoReceived, &ConferenceInfoList::lUpdate);
|
||||
mCoreModelConnection->makeConnectToModel(
|
||||
&CoreModel::conferenceInfoCreated, [this](const std::shared_ptr<linphone::ConferenceInfo> &confInfo) {
|
||||
auto confInfoCore = ConferenceInfoCore::create(confInfo);
|
||||
|
|
@ -132,8 +129,8 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
|||
&CoreModel::conferenceInfoReceived,
|
||||
[this](const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<const linphone::ConferenceInfo> &conferenceInfo) {
|
||||
lDebug() << log().arg("conference info received") << conferenceInfo->getOrganizer()->asStringUriOnly()
|
||||
<< conferenceInfo->getSubject();
|
||||
lDebug() << log().arg("conference info received") << conferenceInfo->getSubject();
|
||||
emit lUpdate();
|
||||
});
|
||||
emit lUpdate();
|
||||
}
|
||||
|
|
@ -171,19 +168,18 @@ int ConferenceInfoList::getCurrentDateIndex() const {
|
|||
}
|
||||
|
||||
void ConferenceInfoList::setCurrentDateIndex(int index) {
|
||||
if (mCurrentDateIndex != index) {
|
||||
mCurrentDateIndex = index;
|
||||
emit currentDateIndexChanged();
|
||||
}
|
||||
mCurrentDateIndex = index;
|
||||
emit currentDateIndexChanged(index);
|
||||
}
|
||||
|
||||
int ConferenceInfoList::findConfInfoIndexByUri(const QString &uri) {
|
||||
auto items = getSharedList<ConferenceInfoCore>();
|
||||
for (int i = 0; i < items.size(); ++i) {
|
||||
if (!items[i]) continue;
|
||||
if (items[i]->getUri() == uri) return i;
|
||||
}
|
||||
return -1;
|
||||
auto confInList = std::find_if(mList.begin(), mList.end(), [uri](const QSharedPointer<QObject> &item) {
|
||||
auto isConfInfo = item.objectCast<ConferenceInfoCore>();
|
||||
if (!isConfInfo) return false;
|
||||
return isConfInfo->getUri() == uri;
|
||||
});
|
||||
|
||||
return (confInList == mList.end() ? -1 : std::distance(mList.begin(), confInList));
|
||||
}
|
||||
|
||||
QSharedPointer<ConferenceInfoCore>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ signals:
|
|||
void lUpdate();
|
||||
void addCurrentDateChanged();
|
||||
void haveCurrentDateChanged();
|
||||
void currentDateIndexChanged();
|
||||
void currentDateIndexChanged(int index);
|
||||
|
||||
private:
|
||||
QSharedPointer<SafeConnection<ConferenceInfoList, CoreModel>> mCoreModelConnection;
|
||||
|
|
|
|||
|
|
@ -57,10 +57,8 @@ int ConferenceInfoProxy::getCurrentDateIndex() const {
|
|||
|
||||
void ConferenceInfoProxy::updateCurrentDateIndex() {
|
||||
int newIndex = mapFromSource(sourceModel()->index(mList->getCurrentDateIndex(), 0)).row();
|
||||
if (mCurrentDateIndex != newIndex) {
|
||||
mCurrentDateIndex = newIndex;
|
||||
emit currentDateIndexChanged();
|
||||
}
|
||||
mCurrentDateIndex = newIndex;
|
||||
emit currentDateIndexChanged(newIndex);
|
||||
}
|
||||
|
||||
bool ConferenceInfoProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
signals:
|
||||
void haveCurrentDateChanged();
|
||||
void currentDateIndexChanged();
|
||||
void currentDateIndexChanged(int index);
|
||||
|
||||
private:
|
||||
QSharedPointer<ConferenceInfoList> mList;
|
||||
|
|
|
|||
|
|
@ -41,10 +41,6 @@ ConferenceInfoModel::~ConferenceInfoModel() {
|
|||
if (mConferenceSchedulerModel) mConferenceSchedulerModel->removeListener();
|
||||
}
|
||||
|
||||
void ConferenceInfoModel::createConferenceScheduler() {
|
||||
mustBeInLinphoneThread(getClassName() + "::createConferenceScheduler()");
|
||||
}
|
||||
|
||||
std::shared_ptr<linphone::ConferenceInfo> ConferenceInfoModel::getConferenceInfo() const {
|
||||
return mConferenceInfo;
|
||||
}
|
||||
|
|
@ -64,6 +60,8 @@ void ConferenceInfoModel::setConferenceScheduler(const std::shared_ptr<Conferenc
|
|||
mConferenceSchedulerModel = model;
|
||||
connect(mConferenceSchedulerModel.get(), &ConferenceSchedulerModel::stateChanged,
|
||||
[this](linphone::ConferenceScheduler::State state) {
|
||||
if (mConferenceSchedulerModel->getConferenceInfo())
|
||||
mConferenceInfo = mConferenceSchedulerModel->getConferenceInfo()->clone();
|
||||
if (state == linphone::ConferenceScheduler::State::Ready && mInviteEnabled) {
|
||||
auto params = CoreModel::getInstance()->getCore()->createDefaultChatRoomParams();
|
||||
// TODO : wait for new sdk api to send the invitations again
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ public:
|
|||
ConferenceInfoModel(const std::shared_ptr<linphone::ConferenceInfo> &conferenceInfo, QObject *parent = nullptr);
|
||||
~ConferenceInfoModel();
|
||||
|
||||
void createConferenceScheduler();
|
||||
|
||||
std::shared_ptr<linphone::ConferenceInfo> getConferenceInfo() const;
|
||||
|
||||
std::shared_ptr<ConferenceSchedulerModel> getConferenceScheduler() const;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ linphone::ConferenceScheduler::State ConferenceSchedulerModel::getState() const
|
|||
return mState;
|
||||
}
|
||||
|
||||
std::shared_ptr<const linphone::ConferenceInfo> ConferenceSchedulerModel::getConferenceInfo() const {
|
||||
return mMonitor->getInfo();
|
||||
}
|
||||
|
||||
void ConferenceSchedulerModel::setInfo(const std::shared_ptr<linphone::ConferenceInfo> &confInfo) {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
mMonitor->setInfo(confInfo);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public:
|
|||
|
||||
QString getUri();
|
||||
linphone::ConferenceScheduler::State getState() const;
|
||||
std::shared_ptr<const linphone::ConferenceInfo> getConferenceInfo() const;
|
||||
void setInfo(const std::shared_ptr<linphone::ConferenceInfo> &confInfo);
|
||||
void cancelConference(const std::shared_ptr<linphone::ConferenceInfo> &confInfo);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ ListView {
|
|||
property var delegateButtons
|
||||
property ConferenceInfoGui selectedConference: model && currentIndex != -1 ? model.getAt(currentIndex) : null
|
||||
|
||||
signal conferenceSelected(var contact)
|
||||
|
||||
spacing: 8 * DefaultStyle.dp
|
||||
currentIndex: confInfoProxy.currentDateIndex
|
||||
// using highlight doesn't center, take time before moving and don't work for not visible item (like not loaded)
|
||||
|
|
@ -26,9 +24,15 @@ ListView {
|
|||
onCountChanged: {
|
||||
selectedConference = model && currentIndex != -1 && currentIndex < model.count ? model.getAt(currentIndex) : null
|
||||
}
|
||||
Connections {
|
||||
target: confInfoProxy
|
||||
function onCurrentDateIndexChanged(index) {
|
||||
mainItem.currentIndex = index
|
||||
}
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
selectedConference = model.getAt(currentIndex) || null
|
||||
positionViewAtIndex(currentIndex, ListView.Center)
|
||||
if (currentIndex != -1) positionViewAtIndex(currentIndex, ListView.Contain)
|
||||
}
|
||||
onVisibleChanged: if( visible) {
|
||||
mainItem.positionViewAtIndex(currentIndex, ListView.Center)// First approximative move
|
||||
|
|
@ -214,23 +218,10 @@ ListView {
|
|||
visible: itemDelegate.haveModel
|
||||
onClicked: {
|
||||
mainItem.currentIndex = index
|
||||
mainItem.conferenceSelected($modelData)
|
||||
itemDelegate.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MouseArea {
|
||||
// id: confArea
|
||||
// hoverEnabled: mainItem.hoverEnabled
|
||||
// visible: !dateDay.visible && itemDelegate.haveModel
|
||||
// anchors.fill: parent
|
||||
// cursorShape: Qt.PointingHandCursor
|
||||
// onClicked: {
|
||||
// mainItem.currentIndex = index
|
||||
// mainItem.conferenceSelected($modelData)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue