mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Fix end date time on conferences.
This commit is contained in:
parent
7755539a33
commit
e4b91a6a66
4 changed files with 51 additions and 4 deletions
|
|
@ -81,6 +81,12 @@ ConferenceInfoModel::ConferenceInfoModel (QObject * parent) : QObject(parent){
|
|||
connect(this, &ConferenceInfoModel::conferenceInfoChanged, this, &ConferenceInfoModel::inviteModeChanged);
|
||||
connect(this, &ConferenceInfoModel::conferenceInfoChanged, this, &ConferenceInfoModel::conferenceInfoStateChanged);
|
||||
connect(this, &ConferenceInfoModel::conferenceInfoChanged, this, &ConferenceInfoModel::conferenceSchedulerStateChanged);
|
||||
|
||||
mCheckEndTimer.callOnTimeout(this, [this]()mutable{setIsEnded(getIsEnded());});
|
||||
mCheckEndTimer.setInterval(10000); // 10s of reaction in order to not overload processes if many calendar
|
||||
mIsEnded = getIsEnded();
|
||||
if(!mIsEnded)
|
||||
mCheckEndTimer.start();
|
||||
}
|
||||
|
||||
// Callable from C++
|
||||
|
|
@ -100,9 +106,16 @@ ConferenceInfoModel::ConferenceInfoModel (std::shared_ptr<linphone::ConferenceIn
|
|||
connect(this, &ConferenceInfoModel::conferenceInfoChanged, this, &ConferenceInfoModel::inviteModeChanged);
|
||||
connect(this, &ConferenceInfoModel::conferenceInfoChanged, this, &ConferenceInfoModel::conferenceInfoStateChanged);
|
||||
connect(this, &ConferenceInfoModel::conferenceInfoChanged, this, &ConferenceInfoModel::conferenceSchedulerStateChanged);
|
||||
|
||||
mCheckEndTimer.callOnTimeout(this, [this]()mutable{setIsEnded(getIsEnded());});
|
||||
mCheckEndTimer.setInterval(10000); // 10s of reaction in order to not overload processes if many calendar.
|
||||
mIsEnded = getIsEnded();
|
||||
if(!mIsEnded)
|
||||
mCheckEndTimer.start();
|
||||
}
|
||||
|
||||
ConferenceInfoModel::~ConferenceInfoModel () {
|
||||
mCheckEndTimer.stop();
|
||||
}
|
||||
|
||||
std::shared_ptr<linphone::ConferenceInfo> ConferenceInfoModel::getConferenceInfo(){
|
||||
|
|
@ -139,6 +152,10 @@ int ConferenceInfoModel::getDuration() const{
|
|||
}
|
||||
|
||||
QDateTime ConferenceInfoModel::getEndDateTime() const{
|
||||
return getDateTimeSystem().addSecs(getDuration()*60);
|
||||
}
|
||||
|
||||
QDateTime ConferenceInfoModel::getEndDateTimeUtc() const{
|
||||
return getDateTimeUtc().addSecs(getDuration()*60);
|
||||
}
|
||||
|
||||
|
|
@ -175,6 +192,14 @@ bool ConferenceInfoModel::isScheduled() const{
|
|||
return mIsScheduled;
|
||||
}
|
||||
|
||||
bool ConferenceInfoModel::isEnded() const{
|
||||
return mIsEnded;
|
||||
}
|
||||
|
||||
bool ConferenceInfoModel::getIsEnded() const{
|
||||
return getEndDateTimeUtc() < QDateTime::currentDateTimeUtc();
|
||||
}
|
||||
|
||||
int ConferenceInfoModel::getInviteMode() const{
|
||||
return mInviteMode;
|
||||
}
|
||||
|
|
@ -234,6 +259,7 @@ LinphoneEnums::ConferenceSchedulerState ConferenceInfoModel::getConferenceSchedu
|
|||
// Datetime is in Custom (Locale/UTC/System). Convert into UTC for conference info
|
||||
void ConferenceInfoModel::setDateTime(const QDateTime& dateTime){
|
||||
mConferenceInfo->setDateTime(dateTime.toMSecsSinceEpoch() / 1000);// toMSecsSinceEpoch() is UTC
|
||||
setIsEnded(getIsEnded());
|
||||
emit dateTimeChanged();
|
||||
}
|
||||
|
||||
|
|
@ -244,6 +270,7 @@ void ConferenceInfoModel::setDateTime(const QDate& date, const QTime& time, Time
|
|||
|
||||
void ConferenceInfoModel::setDuration(const int& duration){
|
||||
mConferenceInfo->setDuration(duration);
|
||||
setIsEnded(getIsEnded());
|
||||
emit durationChanged();
|
||||
}
|
||||
|
||||
|
|
@ -274,6 +301,17 @@ void ConferenceInfoModel::setIsScheduled(const bool& on){
|
|||
}
|
||||
}
|
||||
|
||||
void ConferenceInfoModel::setIsEnded(const bool& end){
|
||||
if( mIsEnded != end){
|
||||
mIsEnded = end;
|
||||
if(mIsEnded)
|
||||
mCheckEndTimer.stop();// No need to run the timer.
|
||||
else
|
||||
mCheckEndTimer.start();
|
||||
emit isEndedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ConferenceInfoModel::setInviteMode(const int& mode){
|
||||
if( mode != mInviteMode){
|
||||
mInviteMode = mode;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QTimeZone>
|
||||
#include <QTimer>
|
||||
|
||||
#include "utils/LinphoneEnums.hpp"
|
||||
|
||||
|
|
@ -48,6 +49,7 @@ public:
|
|||
Q_PROPERTY(QString displayNamesToString READ displayNamesToString NOTIFY participantsChanged)
|
||||
Q_PROPERTY(QString uri READ getUri NOTIFY uriChanged)
|
||||
Q_PROPERTY(bool isScheduled READ isScheduled WRITE setIsScheduled NOTIFY isScheduledChanged)
|
||||
Q_PROPERTY(bool isEnded READ isEnded WRITE setIsEnded NOTIFY isEndedChanged)
|
||||
Q_PROPERTY(int inviteMode READ getInviteMode WRITE setInviteMode NOTIFY inviteModeChanged)
|
||||
Q_PROPERTY(int participantCount READ getParticipantCount NOTIFY participantsChanged)
|
||||
Q_PROPERTY(int allParticipantCount READ getAllParticipantCount NOTIFY participantsChanged)
|
||||
|
|
@ -68,12 +70,15 @@ public:
|
|||
QDateTime getDateTimeSystem() const;
|
||||
int getDuration() const;
|
||||
QDateTime getEndDateTime() const;
|
||||
QDateTime getEndDateTimeUtc() const;
|
||||
QString getOrganizer() const;
|
||||
QString getSubject() const;
|
||||
QString getDescription() const;
|
||||
Q_INVOKABLE QString displayNamesToString()const;
|
||||
QString getUri() const;
|
||||
bool isScheduled() const;
|
||||
bool isEnded() const;
|
||||
bool getIsEnded() const;
|
||||
int getInviteMode() const;
|
||||
Q_INVOKABLE QVariantList getParticipants() const;
|
||||
Q_INVOKABLE QVariantList getAllParticipants() const;
|
||||
|
|
@ -90,6 +95,7 @@ public:
|
|||
void setOrganizer(const QString& organizerAddress);
|
||||
void setDescription(const QString& description);
|
||||
void setIsScheduled(const bool& on);
|
||||
void setIsEnded(const bool& end);
|
||||
void setInviteMode(const int& modes);
|
||||
|
||||
Q_INVOKABLE void setDateTime(const QDate& date, const QTime& time, TimeZoneModel * model);
|
||||
|
|
@ -116,6 +122,7 @@ signals:
|
|||
void participantsChanged();
|
||||
void uriChanged();
|
||||
void isScheduledChanged();
|
||||
void isEndedChanged();
|
||||
void inviteModeChanged();
|
||||
void conferenceInfoStateChanged();
|
||||
void conferenceSchedulerStateChanged();
|
||||
|
|
@ -131,6 +138,8 @@ private:
|
|||
QSharedPointer<ConferenceScheduler> mConferenceScheduler= nullptr;
|
||||
|
||||
bool mIsScheduled = true;
|
||||
bool mIsEnded = false;
|
||||
QTimer mCheckEndTimer;
|
||||
int mInviteMode = 0;
|
||||
bool mRemoveRequested = false;// true if user has request its deletion from DB
|
||||
linphone::ConferenceScheduler::State mLastConferenceSchedulerState = linphone::ConferenceScheduler::State::Idle;// Workaround for missing getter in scheduler.
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ bool ConferenceInfoProxyModel::filterAcceptsRow (int sourceRow, const QModelInde
|
|||
if(ics){
|
||||
if(ics->getDuration() == 0)
|
||||
return false;
|
||||
QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||
QDateTime currentDateTime = QDateTime::currentDateTimeUtc();
|
||||
if( mFilterType == 0){
|
||||
return ics->getEndDateTime() < currentDateTime;
|
||||
return ics->getEndDateTimeUtc() < currentDateTime;
|
||||
}else if( mFilterType == 1){
|
||||
return ics->getEndDateTime() >= currentDateTime;
|
||||
return ics->getEndDateTimeUtc() >= currentDateTime;
|
||||
}else if( mFilterType == 2){
|
||||
return !Utils::isMe(ics->getOrganizer());
|
||||
}else
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ Loader{
|
|||
colorSet: ChatCalendarMessageStyle.editButton
|
||||
backgroundRadius: width/2
|
||||
visible: UtilsCpp.isMe(mainItem.conferenceInfoModel.organizer)
|
||||
&& mainItem.conferenceInfoModel.endDateTime >= new Date()
|
||||
&& !mainItem.conferenceInfoModel.isEnded
|
||||
&& !mainItem.isCancelled
|
||||
onClicked: {
|
||||
window.detachVirtualWindow()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue