fix autoscroll to current date meeting #LINQT-1886
This commit is contained in:
parent
d742fa9ea0
commit
1ddfae8802
5 changed files with 18 additions and 19 deletions
|
|
@ -58,8 +58,8 @@ ConferenceInfoList::~ConferenceInfoList() {
|
||||||
void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
||||||
mCoreModelConnection = SafeConnection<ConferenceInfoList, CoreModel>::create(me, CoreModel::getInstance());
|
mCoreModelConnection = SafeConnection<ConferenceInfoList, CoreModel>::create(me, CoreModel::getInstance());
|
||||||
|
|
||||||
mCoreModelConnection->makeConnectToCore(&ConferenceInfoList::lUpdate, [this](bool isInitialization) {
|
mCoreModelConnection->makeConnectToCore(&ConferenceInfoList::lUpdate, [this]() {
|
||||||
mCoreModelConnection->invokeToModel([this, isInitialization]() {
|
mCoreModelConnection->invokeToModel([this]() {
|
||||||
QList<QSharedPointer<ConferenceInfoCore>> *items = new QList<QSharedPointer<ConferenceInfoCore>>();
|
QList<QSharedPointer<ConferenceInfoCore>> *items = new QList<QSharedPointer<ConferenceInfoCore>>();
|
||||||
mustBeInLinphoneThread(getClassName());
|
mustBeInLinphoneThread(getClassName());
|
||||||
auto defaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
|
auto defaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
|
||||||
|
|
@ -82,16 +82,13 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
||||||
items->push_back(confInfoCore);
|
items->push_back(confInfoCore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mCoreModelConnection->invokeToCore([this, items, isInitialization]() {
|
mCoreModelConnection->invokeToCore([this, items]() {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
for (auto &item : *items) {
|
for (auto &item : *items) {
|
||||||
connectItem(item);
|
connectItem(item);
|
||||||
}
|
}
|
||||||
resetData(*items);
|
resetData(*items);
|
||||||
delete items;
|
delete items;
|
||||||
if (isInitialization) {
|
|
||||||
emit initialized();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -118,7 +115,7 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
||||||
if (mCurrentAccountCore)
|
if (mCurrentAccountCore)
|
||||||
connect(mCurrentAccountCore.get(), &AccountCore::registrationStateChanged, this,
|
connect(mCurrentAccountCore.get(), &AccountCore::registrationStateChanged, this,
|
||||||
[this] { emit lUpdate(); });
|
[this] { emit lUpdate(); });
|
||||||
emit lUpdate(true);
|
emit lUpdate();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
mCoreModelConnection->invokeToModel([this] {
|
mCoreModelConnection->invokeToModel([this] {
|
||||||
|
|
@ -131,7 +128,7 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
||||||
[this] { emit lUpdate(); });
|
[this] { emit lUpdate(); });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
emit lUpdate(true);
|
emit lUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConferenceInfoList::setAccountConnected(bool connected) {
|
void ConferenceInfoList::setAccountConnected(bool connected) {
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,7 @@ public:
|
||||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void lUpdate(bool isInitialization = false);
|
void lUpdate();
|
||||||
void initialized();
|
|
||||||
void addCurrentDateChanged();
|
void addCurrentDateChanged();
|
||||||
void haveCurrentDateChanged();
|
void haveCurrentDateChanged();
|
||||||
void currentDateIndexChanged(int index);
|
void currentDateIndexChanged(int index);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : LimitProxy(parent) {
|
||||||
if (isSignalConnected(conferenceInfoUpdatedSignal)) emit conferenceInfoUpdated(new ConferenceInfoGui(data));
|
if (isSignalConnected(conferenceInfoUpdatedSignal)) emit conferenceInfoUpdated(new ConferenceInfoGui(data));
|
||||||
},
|
},
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(mList.get(), &ConferenceInfoList::initialized, this, &ConferenceInfoProxy::initialized);
|
|
||||||
connect(mList.get(), &ConferenceInfoList::accountConnectedChanged, this,
|
connect(mList.get(), &ConferenceInfoList::accountConnectedChanged, this,
|
||||||
&ConferenceInfoProxy::accountConnectedChanged);
|
&ConferenceInfoProxy::accountConnectedChanged);
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +104,14 @@ void ConferenceInfoProxy::clear() {
|
||||||
mList->clearData();
|
mList->clearData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConferenceInfoGui *ConferenceInfoProxy::getCurrentDateConfInfo() {
|
||||||
|
if (mList) {
|
||||||
|
auto confInfo = mList->getCurrentDateConfInfo();
|
||||||
|
return confInfo ? new ConferenceInfoGui(confInfo) : nullptr;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int ConferenceInfoProxy::loadUntil(ConferenceInfoGui *confInfo) {
|
int ConferenceInfoProxy::loadUntil(ConferenceInfoGui *confInfo) {
|
||||||
return loadUntil(confInfo ? confInfo->mCore : nullptr);
|
return loadUntil(confInfo ? confInfo->mCore : nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,10 @@ public:
|
||||||
bool getAccountConnected() const;
|
bool getAccountConnected() const;
|
||||||
|
|
||||||
Q_INVOKABLE void clear();
|
Q_INVOKABLE void clear();
|
||||||
|
Q_INVOKABLE ConferenceInfoGui *getCurrentDateConfInfo();
|
||||||
Q_INVOKABLE int loadUntil(ConferenceInfoGui *confInfo);
|
Q_INVOKABLE int loadUntil(ConferenceInfoGui *confInfo);
|
||||||
int loadUntil(QSharedPointer<ConferenceInfoCore> data);
|
int loadUntil(QSharedPointer<ConferenceInfoCore> data);
|
||||||
signals:
|
signals:
|
||||||
void initialized();
|
|
||||||
void haveCurrentDateChanged();
|
void haveCurrentDateChanged();
|
||||||
void conferenceInfoCreated(ConferenceInfoGui *confInfo);
|
void conferenceInfoCreated(ConferenceInfoGui *confInfo);
|
||||||
void conferenceInfoUpdated(ConferenceInfoGui *confInfo);
|
void conferenceInfoUpdated(ConferenceInfoGui *confInfo);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ ListView {
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
function moveToCurrentItem(){
|
function moveToCurrentItem(){
|
||||||
if( mainItem.currentIndex >= 0)
|
if( mainItem.currentIndex >= 0)
|
||||||
Utils.updatePosition(mainItem, mainItem)
|
mainItem.positionViewAtIndex(mainItem.currentIndex, ListView.Contain)
|
||||||
}
|
}
|
||||||
onCurrentItemChanged: {
|
onCurrentItemChanged: {
|
||||||
moveToCurrentItem()
|
moveToCurrentItem()
|
||||||
|
|
@ -97,13 +97,13 @@ ListView {
|
||||||
}
|
}
|
||||||
onModelReset: {
|
onModelReset: {
|
||||||
mainItem.loading = !confInfoProxy.accountConnected
|
mainItem.loading = !confInfoProxy.accountConnected
|
||||||
|
selectData(getCurrentDateConfInfo())
|
||||||
}
|
}
|
||||||
onAccountConnectedChanged: (connected) => {
|
onAccountConnectedChanged: (connected) => {
|
||||||
mainItem.loading = !connected
|
mainItem.loading = !connected
|
||||||
}
|
}
|
||||||
function selectData(confInfoGui){
|
function selectData(confInfoGui){
|
||||||
mainItem.currentIndex = loadUntil(confInfoGui)
|
mainItem.currentIndex = loadUntil(confInfoGui)
|
||||||
mainItem.positionViewAtIndex(mainItem.currentIndex, ListView.Contain)
|
|
||||||
}
|
}
|
||||||
onConferenceInfoCreated: (confInfoGui) => {
|
onConferenceInfoCreated: (confInfoGui) => {
|
||||||
selectData(confInfoGui)
|
selectData(confInfoGui)
|
||||||
|
|
@ -111,10 +111,6 @@ ListView {
|
||||||
onConferenceInfoUpdated: (confInfoGui) => {
|
onConferenceInfoUpdated: (confInfoGui) => {
|
||||||
selectData(confInfoGui)
|
selectData(confInfoGui)
|
||||||
}
|
}
|
||||||
onInitialized: {
|
|
||||||
// Move to currentDate
|
|
||||||
selectData(null)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue