mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
Mac crash on empty models, avoid deleting chat room right after creation (SDK bug), timeline switching, Chat Send button, contact edit redirection to chat
This commit is contained in:
parent
1397e483b3
commit
3a1c571c58
15 changed files with 243 additions and 60 deletions
|
|
@ -360,6 +360,7 @@ QVariantMap CallsListModel::createChatRoom(const QString& subject, const int& se
|
|||
}
|
||||
}
|
||||
result["created"] = (chatRoom != nullptr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ QString ChatMessageModel::AppDataManager::toString(){
|
|||
ChatMessageModel::ChatMessageModel ( std::shared_ptr<linphone::ChatMessage> chatMessage, QObject * parent) : QObject(parent), ChatEvent(ChatRoomModel::EntryType::MessageEntry) {
|
||||
App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it
|
||||
mParticipantImdnStateListModel = std::make_shared<ParticipantImdnStateListModel>(chatMessage);
|
||||
mChatMessageListener = std::make_shared<ChatMessageListener>(this, parent);
|
||||
mChatMessageListener = std::make_shared<ChatMessageListener>(this, parent);
|
||||
mChatMessage = chatMessage;
|
||||
mWasDownloaded = false;
|
||||
mChatMessage->addListener(mChatMessageListener);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class ChatMessageListener : public QObject, public linphone::ChatMessageListener
|
|||
Q_OBJECT
|
||||
public:
|
||||
ChatMessageListener(ChatMessageModel * model, QObject * parent = nullptr);
|
||||
virtual ~ChatMessageListener(){};
|
||||
virtual ~ChatMessageListener(){}
|
||||
|
||||
virtual void onFileTransferRecv(const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<linphone::Content> & content, const std::shared_ptr<const linphone::Buffer> & buffer) override;
|
||||
virtual void onFileTransferSendChunk(const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<linphone::Content> & content, size_t offset, size_t size, const std::shared_ptr<linphone::Buffer> & buffer) override;
|
||||
|
|
|
|||
|
|
@ -74,23 +74,131 @@ constexpr qint64 FileSizeLimit = 524288000;
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ChatRoomModelListener::ChatRoomModelListener(ChatRoomModel * model, QObject* parent) : QObject(parent){
|
||||
connect(this, &ChatRoomModelListener::isComposingReceived, model, &ChatRoomModel::onIsComposingReceived);
|
||||
connect(this, &ChatRoomModelListener::messageReceived, model, &ChatRoomModel::onMessageReceived);
|
||||
connect(this, &ChatRoomModelListener::newEvent, model, &ChatRoomModel::onNewEvent);
|
||||
connect(this, &ChatRoomModelListener::chatMessageReceived, model, &ChatRoomModel::onChatMessageReceived);
|
||||
connect(this, &ChatRoomModelListener::chatMessageSending, model, &ChatRoomModel::onChatMessageSending);
|
||||
connect(this, &ChatRoomModelListener::chatMessageSent, model, &ChatRoomModel::onChatMessageSent);
|
||||
connect(this, &ChatRoomModelListener::participantAdded, model, &ChatRoomModel::onParticipantAdded);
|
||||
connect(this, &ChatRoomModelListener::participantRemoved, model, &ChatRoomModel::onParticipantRemoved);
|
||||
connect(this, &ChatRoomModelListener::participantAdminStatusChanged, model, &ChatRoomModel::onParticipantAdminStatusChanged);
|
||||
connect(this, &ChatRoomModelListener::stateChanged, model, &ChatRoomModel::onStateChanged);
|
||||
connect(this, &ChatRoomModelListener::securityEvent, model, &ChatRoomModel::onSecurityEvent);
|
||||
connect(this, &ChatRoomModelListener::subjectChanged, model, &ChatRoomModel::onSubjectChanged);
|
||||
connect(this, &ChatRoomModelListener::undecryptableMessageReceived, model, &ChatRoomModel::onUndecryptableMessageReceived);
|
||||
connect(this, &ChatRoomModelListener::participantDeviceAdded, model, &ChatRoomModel::onParticipantDeviceAdded);
|
||||
connect(this, &ChatRoomModelListener::participantDeviceRemoved, model, &ChatRoomModel::onParticipantDeviceRemoved);
|
||||
connect(this, &ChatRoomModelListener::conferenceJoined, model, &ChatRoomModel::onConferenceJoined);
|
||||
connect(this, &ChatRoomModelListener::conferenceLeft, model, &ChatRoomModel::onConferenceLeft);
|
||||
connect(this, &ChatRoomModelListener::ephemeralEvent, model, &ChatRoomModel::onEphemeralEvent);
|
||||
connect(this, &ChatRoomModelListener::ephemeralMessageTimerStarted, model, &ChatRoomModel::onEphemeralMessageTimerStarted);
|
||||
connect(this, &ChatRoomModelListener::ephemeralMessageDeleted, model, &ChatRoomModel::onEphemeralMessageDeleted);
|
||||
connect(this, &ChatRoomModelListener::conferenceAddressGeneration, model, &ChatRoomModel::onConferenceAddressGeneration);
|
||||
connect(this, &ChatRoomModelListener::participantRegistrationSubscriptionRequested, model, &ChatRoomModel::onParticipantRegistrationSubscriptionRequested);
|
||||
connect(this, &ChatRoomModelListener::participantRegistrationUnsubscriptionRequested, model, &ChatRoomModel::onParticipantRegistrationUnsubscriptionRequested);
|
||||
connect(this, &ChatRoomModelListener::chatMessageShouldBeStored, model, &ChatRoomModel::onChatMessageShouldBeStored);
|
||||
connect(this, &ChatRoomModelListener::chatMessageParticipantImdnStateChanged, model, &ChatRoomModel::onChatMessageParticipantImdnStateChanged);
|
||||
}
|
||||
|
||||
void ChatRoomModelListener::onIsComposingReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & remoteAddress, bool isComposing){
|
||||
emit isComposingReceived(chatRoom, remoteAddress, isComposing);
|
||||
}
|
||||
void ChatRoomModelListener::onMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message){
|
||||
emit messageReceived(chatRoom, message);
|
||||
}
|
||||
void ChatRoomModelListener::onNewEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit newEvent(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onChatMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit chatMessageReceived(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onChatMessageSending(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit chatMessageSending(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onChatMessageSent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit chatMessageSent(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onParticipantAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit participantAdded(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onParticipantRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit participantRemoved(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onParticipantAdminStatusChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit participantAdminStatusChanged(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, linphone::ChatRoom::State newState){
|
||||
emit stateChanged(chatRoom, newState);
|
||||
}
|
||||
void ChatRoomModelListener::onSecurityEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit securityEvent(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onSubjectChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit subjectChanged(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onUndecryptableMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message){
|
||||
emit undecryptableMessageReceived(chatRoom, message);
|
||||
}
|
||||
void ChatRoomModelListener::onParticipantDeviceAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit participantDeviceAdded(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onParticipantDeviceRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit participantDeviceRemoved(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onConferenceJoined(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit conferenceJoined(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onConferenceLeft(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit conferenceLeft(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onEphemeralEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit ephemeralEvent(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onEphemeralMessageTimerStarted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit ephemeralMessageTimerStarted(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onEphemeralMessageDeleted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
|
||||
emit ephemeralMessageDeleted(chatRoom, eventLog);
|
||||
}
|
||||
void ChatRoomModelListener::onConferenceAddressGeneration(const std::shared_ptr<linphone::ChatRoom> & chatRoom){
|
||||
emit conferenceAddressGeneration(chatRoom);
|
||||
}
|
||||
void ChatRoomModelListener::onParticipantRegistrationSubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress){
|
||||
emit participantRegistrationSubscriptionRequested(chatRoom, participantAddress);
|
||||
}
|
||||
void ChatRoomModelListener::onParticipantRegistrationUnsubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress){
|
||||
emit participantRegistrationUnsubscriptionRequested(chatRoom, participantAddress);
|
||||
}
|
||||
void ChatRoomModelListener::onChatMessageShouldBeStored(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message){
|
||||
emit chatMessageShouldBeStored(chatRoom, message);
|
||||
}
|
||||
void ChatRoomModelListener::onChatMessageParticipantImdnStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ParticipantImdnState> & state){
|
||||
emit chatMessageParticipantImdnStateChanged(chatRoom, message, state);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
std::shared_ptr<ChatRoomModel> ChatRoomModel::create(std::shared_ptr<linphone::ChatRoom> chatRoom){
|
||||
std::shared_ptr<ChatRoomModel> model = std::make_shared<ChatRoomModel>(chatRoom);
|
||||
if(model){
|
||||
model->mSelf = model;
|
||||
chatRoom->addListener(model);
|
||||
//chatRoom->addListener(model);
|
||||
return model;
|
||||
}else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ChatRoomModel::ChatRoomModel (std::shared_ptr<linphone::ChatRoom> chatRoom){
|
||||
ChatRoomModel::ChatRoomModel (std::shared_ptr<linphone::ChatRoom> chatRoom, QObject * parent) : QAbstractListModel(parent){
|
||||
App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
|
||||
mCoreHandlers = coreManager->getHandlers();
|
||||
|
||||
mChatRoom = chatRoom;
|
||||
mChatRoomModelListener = std::make_shared<ChatRoomModelListener>(this, parent);
|
||||
mChatRoom->addListener(mChatRoomModelListener);
|
||||
|
||||
setLastUpdateTime(QDateTime::fromMSecsSinceEpoch(mChatRoom->getLastUpdateTime()));
|
||||
setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount());
|
||||
|
|
@ -127,8 +235,19 @@ ChatRoomModel::ChatRoomModel (std::shared_ptr<linphone::ChatRoom> chatRoom){
|
|||
|
||||
ChatRoomModel::~ChatRoomModel () {
|
||||
mParticipantListModel = nullptr;
|
||||
if(mChatRoom && mDeleteChatRoom)
|
||||
CoreManager::getInstance()->getCore()->deleteChatRoom(mChatRoom);
|
||||
if(mChatRoom){
|
||||
mChatRoom->removeListener(mChatRoomModelListener);
|
||||
if(mDeleteChatRoom){
|
||||
mDeleteChatRoom = false;
|
||||
auto participants = mChatRoom->getParticipants();
|
||||
std::list<std::shared_ptr<linphone::Address>> participantsAddress;
|
||||
for(auto p : participants)
|
||||
participantsAddress.push_back(p->getAddress()->clone());
|
||||
auto internalChatRoom = CoreManager::getInstance()->getCore()->searchChatRoom(mChatRoom->getCurrentParams(), mChatRoom->getLocalAddress(), mChatRoom->getPeerAddress(), participantsAddress);
|
||||
if( internalChatRoom)
|
||||
CoreManager::getInstance()->getCore()->deleteChatRoom(internalChatRoom);
|
||||
}
|
||||
}
|
||||
mChatRoom = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,71 @@ class ParticipantModel;
|
|||
class ParticipantListModel;
|
||||
class ChatEvent;
|
||||
class ContactModel;
|
||||
class ChatRoomModel;
|
||||
|
||||
class ChatRoomModel : public QAbstractListModel, public linphone::ChatRoomListener {
|
||||
class ChatRoomModelListener : public QObject, public linphone::ChatRoomListener {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChatRoomModelListener(ChatRoomModel * model, QObject * parent = nullptr);
|
||||
virtual ~ChatRoomModelListener(){}
|
||||
|
||||
virtual void onIsComposingReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & remoteAddress, bool isComposing) override;
|
||||
virtual void onMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message) override;
|
||||
virtual void onNewEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onChatMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onChatMessageSending(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onChatMessageSent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantAdminStatusChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, linphone::ChatRoom::State newState) override;
|
||||
virtual void onSecurityEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onSubjectChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onUndecryptableMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message) override;
|
||||
virtual void onParticipantDeviceAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantDeviceRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onConferenceJoined(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onConferenceLeft(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onEphemeralEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onEphemeralMessageTimerStarted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onEphemeralMessageDeleted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onConferenceAddressGeneration(const std::shared_ptr<linphone::ChatRoom> & chatRoom) override;
|
||||
virtual void onParticipantRegistrationSubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress) override;
|
||||
virtual void onParticipantRegistrationUnsubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress) override;
|
||||
virtual void onChatMessageShouldBeStored(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message) override;
|
||||
virtual void onChatMessageParticipantImdnStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ParticipantImdnState> & state) override;
|
||||
|
||||
signals:
|
||||
void isComposingReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & remoteAddress, bool isComposing);
|
||||
void messageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message);
|
||||
void newEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void chatMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void chatMessageSending(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void chatMessageSent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void participantAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void participantRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void participantAdminStatusChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void stateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, linphone::ChatRoom::State newState);
|
||||
void securityEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void subjectChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void undecryptableMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message);
|
||||
void participantDeviceAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void participantDeviceRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void conferenceJoined(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void conferenceLeft(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void ephemeralEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void ephemeralMessageTimerStarted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void ephemeralMessageDeleted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
void conferenceAddressGeneration(const std::shared_ptr<linphone::ChatRoom> & chatRoom);
|
||||
void participantRegistrationSubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress);
|
||||
void participantRegistrationUnsubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress);
|
||||
void chatMessageShouldBeStored(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message);
|
||||
void chatMessageParticipantImdnStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ParticipantImdnState> & state);
|
||||
|
||||
|
||||
};
|
||||
|
||||
class ChatRoomModel : public QAbstractListModel {
|
||||
class MessageHandlers;
|
||||
|
||||
Q_OBJECT
|
||||
|
|
@ -89,7 +152,7 @@ public:
|
|||
|
||||
//ChatRoomModel (const QString &peerAddress, const QString &localAddress, const bool& isSecure);
|
||||
static std::shared_ptr<ChatRoomModel> create(std::shared_ptr<linphone::ChatRoom> chatRoom);
|
||||
ChatRoomModel (std::shared_ptr<linphone::ChatRoom> chatRoom);
|
||||
ChatRoomModel (std::shared_ptr<linphone::ChatRoom> chatRoom, QObject * parent = nullptr);
|
||||
~ChatRoomModel ();
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const override;
|
||||
|
|
@ -160,34 +223,34 @@ public:
|
|||
|
||||
//-------------------- CHAT ROOM HANDLER
|
||||
|
||||
|
||||
virtual void onIsComposingReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & remoteAddress, bool isComposing) override;
|
||||
virtual void onMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message) override;
|
||||
virtual void onNewEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onChatMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onChatMessageSending(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onChatMessageSent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantAdminStatusChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, linphone::ChatRoom::State newState) override;
|
||||
virtual void onSecurityEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onSubjectChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onUndecryptableMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message) override;
|
||||
virtual void onParticipantDeviceAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onParticipantDeviceRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onConferenceJoined(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onConferenceLeft(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onEphemeralEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onEphemeralMessageTimerStarted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onEphemeralMessageDeleted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) override;
|
||||
virtual void onConferenceAddressGeneration(const std::shared_ptr<linphone::ChatRoom> & chatRoom) override;
|
||||
virtual void onParticipantRegistrationSubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress) override;
|
||||
virtual void onParticipantRegistrationUnsubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress) override;
|
||||
virtual void onChatMessageShouldBeStored(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message) override;
|
||||
virtual void onChatMessageParticipantImdnStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ParticipantImdnState> & state) override;
|
||||
|
||||
public slots:
|
||||
virtual void onIsComposingReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & remoteAddress, bool isComposing);
|
||||
virtual void onMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message);
|
||||
virtual void onNewEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onChatMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onChatMessageSending(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onChatMessageSent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onParticipantAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onParticipantRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onParticipantAdminStatusChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, linphone::ChatRoom::State newState);
|
||||
virtual void onSecurityEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onSubjectChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onUndecryptableMessageReceived(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message);
|
||||
virtual void onParticipantDeviceAdded(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onParticipantDeviceRemoved(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onConferenceJoined(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onConferenceLeft(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onEphemeralEvent(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onEphemeralMessageTimerStarted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onEphemeralMessageDeleted(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog);
|
||||
virtual void onConferenceAddressGeneration(const std::shared_ptr<linphone::ChatRoom> & chatRoom);
|
||||
virtual void onParticipantRegistrationSubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress);
|
||||
virtual void onParticipantRegistrationUnsubscriptionRequested(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::Address> & participantAddress);
|
||||
virtual void onChatMessageShouldBeStored(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message);
|
||||
virtual void onChatMessageParticipantImdnStateChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<const linphone::ParticipantImdnState> & state) ;
|
||||
|
||||
|
||||
void removeEntry(ChatEvent* entry);
|
||||
|
||||
signals:
|
||||
|
|
@ -255,6 +318,8 @@ private:
|
|||
std::shared_ptr<MessageHandlers> mMessageHandlers;
|
||||
QMap<std::shared_ptr<const linphone::Address>, QString> mComposers; // Store all addresses that are composing with its username
|
||||
std::shared_ptr<linphone::ChatRoom> mChatRoom;
|
||||
std::shared_ptr<ChatRoomModelListener> mChatRoomModelListener;
|
||||
|
||||
std::weak_ptr<ChatRoomModel> mSelf;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ int ParticipantImdnStateProxyModel::getCount(){
|
|||
return rowCount();
|
||||
}
|
||||
|
||||
ChatMessageModel * ParticipantImdnStateProxyModel::getChatMessageModel(){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ParticipantImdnStateProxyModel::setChatMessageModel(ChatMessageModel * message){
|
||||
ParticipantImdnStateListModel *model = static_cast<ParticipantImdnStateListModel*>(sourceModel());
|
||||
ParticipantImdnStateListModel *messageModel = message->getParticipantImdnStates().get();
|
||||
|
|
|
|||
|
|
@ -36,11 +36,13 @@ class ParticipantImdnStateProxyModel : public QSortFilterProxyModel {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(ChatMessageModel * chatMessageModel WRITE setChatMessageModel NOTIFY chatMessageModelChanged)
|
||||
Q_PROPERTY(ChatMessageModel * chatMessageModel READ getChatMessageModel WRITE setChatMessageModel NOTIFY chatMessageModelChanged)
|
||||
Q_PROPERTY(int count READ getCount NOTIFY countChanged)
|
||||
ParticipantImdnStateProxyModel (QObject *parent = nullptr);
|
||||
|
||||
ChatMessageModel * getChatMessageModel();
|
||||
void setChatMessageModel(ChatMessageModel* message);
|
||||
|
||||
int getCount();
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ SearchSipAddressesModel::~SearchSipAddressesModel(){
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
int SearchSipAddressesModel::rowCount (const QModelIndex &) const {
|
||||
return mAddresses.count()-1;
|
||||
return std::max(mAddresses.count()-1,0);
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> SearchSipAddressesModel::roleNames () const {
|
||||
|
|
|
|||
|
|
@ -292,11 +292,12 @@ void TimelineListModel::remove(std::shared_ptr<TimelineModel> model){
|
|||
}
|
||||
}
|
||||
void TimelineListModel::removeChatRoomModel(std::shared_ptr<ChatRoomModel> model){
|
||||
if(model->getChatRoom()->isEmpty() && (model->hasBeenLeft() || !model->isGroupEnabled())){
|
||||
if(!model || (model->getChatRoom()->isEmpty() && (model->hasBeenLeft() || !model->isGroupEnabled()))){
|
||||
auto itTimeline = mTimelines.begin();
|
||||
while(itTimeline != mTimelines.end()) {
|
||||
if((*itTimeline)->mChatRoomModel == model){
|
||||
model->deleteChatRoom();
|
||||
if(model)
|
||||
model->deleteChatRoom();
|
||||
remove(*itTimeline);
|
||||
return;
|
||||
}else
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ TimelineModel::TimelineModel (std::shared_ptr<linphone::ChatRoom> chatRoom, QObj
|
|||
}
|
||||
|
||||
TimelineModel::~TimelineModel(){
|
||||
mChatRoomModel->getChatRoom()->removeListener(mChatRoomModel);
|
||||
//mChatRoomModel->getChatRoom()->removeListener(mChatRoomModel);
|
||||
}
|
||||
|
||||
QString TimelineModel::getFullPeerAddress() const{
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@ Item {
|
|||
iconSize: wrappedButton.iconSize || (
|
||||
parent.width > parent.height ? parent.height : parent.width
|
||||
)
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -200,11 +200,11 @@ Item {
|
|||
DroppableTextAreaStyle.fileChooserButton.margins
|
||||
verticalCenter: parent.verticalCenter
|
||||
}*/
|
||||
enabled: droppableTextArea.dropEnabled
|
||||
//enabled: droppableTextArea.dropEnabled
|
||||
icon: 'send'
|
||||
iconSize: DroppableTextAreaStyle.fileChooserButton.size
|
||||
useStates:false
|
||||
onClicked: handleValidation()
|
||||
onClicked: textArea.handleValidation()
|
||||
Icon{
|
||||
visible:droppableTextArea.isEphemeral
|
||||
icon:'timer'
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ Rectangle {
|
|||
id:showHistory
|
||||
anchors.fill:parent
|
||||
onClicked: {
|
||||
//view.currentIndex = -1
|
||||
//timeline.entrySelected('',false)
|
||||
filterView.visible = !filterView.visible
|
||||
}
|
||||
}
|
||||
|
|
@ -280,6 +278,8 @@ Rectangle {
|
|||
anchors.fill: parent
|
||||
onClicked: {
|
||||
//timeline.model.unselectAll()
|
||||
if(modelData.selected)
|
||||
timeline.entrySelected(modelData)
|
||||
modelData.selected = true
|
||||
view.currentIndex = index;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,13 +169,7 @@ ColumnLayout {
|
|||
|
||||
sipAddresses: _contact ? _contact.vcard.sipAddresses : [ contactEdit.sipAddress ]
|
||||
|
||||
onSipAddressClicked: window.setView('Conversation', {
|
||||
|
||||
peerAddress: sipAddress,
|
||||
localAddress: AccountSettingsModel.sipAddress,
|
||||
fullPeerAddress: sipAddress,
|
||||
fullLocalAddress: AccountSettingsModel.fullSipAddress
|
||||
})
|
||||
onSipAddressClicked: CallsListModel.launchChat( sipAddress,0 )
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -179,15 +179,6 @@ ApplicationWindow {
|
|||
window.setView('ContactEdit', { sipAddress: entry.sipAddress })
|
||||
} else {
|
||||
CallsListModel.createChatRoom( "", false, sipAddress )
|
||||
/*
|
||||
window.setView('Conversation', {
|
||||
isSecure: entry.isSecure,
|
||||
peerAddress: entry.sipAddress,
|
||||
fullPeerAddress: entry.fullSipAddress,
|
||||
fullLocalAddress: AccountSettingsModel.fullSipAddress,
|
||||
localAddress: AccountSettingsModel.sipAddress
|
||||
|
||||
})*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue