Fixes :
rename fr translation set enableVideo to false if audio call #LINQT-2086 try to fix crash on macos when switching from call window to main window (#LINQT-2077 and #LINQT-2087) set error message when not able to download attached file fix remove chat from list fix new chat connection after first message sent #LINQT-2090 clean code + invalidate() for Qt6.10 compatibility fix translations
This commit is contained in:
parent
d4ce80f8c6
commit
2d9f568e3d
28 changed files with 1091 additions and 968 deletions
|
|
@ -207,7 +207,7 @@ void ChatCore::setSelf(QSharedPointer<ChatCore> me) {
|
||||||
&ChatModel::newEvent, [this](const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
&ChatModel::newEvent, [this](const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
const std::shared_ptr<const linphone::EventLog> &eventLog) {
|
const std::shared_ptr<const linphone::EventLog> &eventLog) {
|
||||||
if (mChatModel->getMonitor() != chatRoom) return;
|
if (mChatModel->getMonitor() != chatRoom) return;
|
||||||
qDebug() << "EVENT LOG RECEIVED IN CHATROOM" << mChatModel->getTitle();
|
lDebug() << "EVENT LOG RECEIVED IN CHATROOM" << mChatModel->getTitle();
|
||||||
auto event = EventLogCore::create(eventLog);
|
auto event = EventLogCore::create(eventLog);
|
||||||
if (event->isHandled()) {
|
if (event->isHandled()) {
|
||||||
mChatModelConnection->invokeToCore([this, event]() { emit eventsInserted({event}); });
|
mChatModelConnection->invokeToCore([this, event]() { emit eventsInserted({event}); });
|
||||||
|
|
@ -220,7 +220,7 @@ void ChatCore::setSelf(QSharedPointer<ChatCore> me) {
|
||||||
&ChatModel::chatMessagesReceived, [this](const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
&ChatModel::chatMessagesReceived, [this](const std::shared_ptr<linphone::ChatRoom> &chatRoom,
|
||||||
const std::list<std::shared_ptr<linphone::EventLog>> &eventsLog) {
|
const std::list<std::shared_ptr<linphone::EventLog>> &eventsLog) {
|
||||||
if (mChatModel->getMonitor() != chatRoom) return;
|
if (mChatModel->getMonitor() != chatRoom) return;
|
||||||
qDebug() << "CHAT MESSAGE RECEIVED IN CHATROOM" << mChatModel->getTitle();
|
lDebug() << "CHAT MESSAGE RECEIVED IN CHATROOM" << mChatModel->getTitle();
|
||||||
QList<QSharedPointer<EventLogCore>> list;
|
QList<QSharedPointer<EventLogCore>> list;
|
||||||
for (auto &e : eventsLog) {
|
for (auto &e : eventsLog) {
|
||||||
auto event = EventLogCore::create(e);
|
auto event = EventLogCore::create(e);
|
||||||
|
|
@ -491,7 +491,7 @@ ChatMessageGui *ChatCore::getLastMessage() const {
|
||||||
|
|
||||||
void ChatCore::setLastMessage(QSharedPointer<ChatMessageCore> lastMessage) {
|
void ChatCore::setLastMessage(QSharedPointer<ChatMessageCore> lastMessage) {
|
||||||
if (mLastMessage != lastMessage) {
|
if (mLastMessage != lastMessage) {
|
||||||
disconnect(mLastMessage.get());
|
if (mLastMessage) disconnect(mLastMessage.get(), &ChatMessageCore::messageStateChanged, this, nullptr);
|
||||||
mLastMessage = lastMessage;
|
mLastMessage = lastMessage;
|
||||||
connect(mLastMessage.get(), &ChatMessageCore::messageStateChanged, this, &ChatCore::lastMessageChanged);
|
connect(mLastMessage.get(), &ChatMessageCore::messageStateChanged, this, &ChatCore::lastMessageChanged);
|
||||||
emit lastMessageChanged();
|
emit lastMessageChanged();
|
||||||
|
|
@ -544,10 +544,6 @@ std::shared_ptr<ChatModel> ChatCore::getModel() const {
|
||||||
return mChatModel;
|
return mChatModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<SafeConnection<ChatCore, ChatModel>> ChatCore::getChatModelConnection() const {
|
|
||||||
return mChatModelConnection;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatCore::isMuted() const {
|
bool ChatCore::isMuted() const {
|
||||||
return mIsMuted;
|
return mIsMuted;
|
||||||
}
|
}
|
||||||
|
|
@ -681,4 +677,4 @@ void ChatCore::updateInfo(const std::shared_ptr<linphone::Friend> &updatedFriend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@ public:
|
||||||
void setComposingAddress(QString composingAddress);
|
void setComposingAddress(QString composingAddress);
|
||||||
|
|
||||||
std::shared_ptr<ChatModel> getModel() const;
|
std::shared_ptr<ChatModel> getModel() const;
|
||||||
QSharedPointer<SafeConnection<ChatCore, ChatModel>> getChatModelConnection() const;
|
|
||||||
|
|
||||||
void setParticipants(QList<QSharedPointer<ParticipantCore>> participants);
|
void setParticipants(QList<QSharedPointer<ParticipantCore>> participants);
|
||||||
QList<QSharedPointer<ParticipantCore>> buildParticipants(const std::shared_ptr<linphone::ChatRoom> &chatRoom) const;
|
QList<QSharedPointer<ParticipantCore>> buildParticipants(const std::shared_ptr<linphone::ChatRoom> &chatRoom) const;
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,11 @@ ChatList::~ChatList() {
|
||||||
|
|
||||||
void ChatList::connectItem(QSharedPointer<ChatCore> chat) {
|
void ChatList::connectItem(QSharedPointer<ChatCore> chat) {
|
||||||
connect(chat.get(), &ChatCore::deleted, this, [this, chat] {
|
connect(chat.get(), &ChatCore::deleted, this, [this, chat] {
|
||||||
disconnect(chat.get());
|
disconnect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, nullptr);
|
||||||
|
disconnect(chat.get(), &ChatCore::lastUpdatedTimeChanged, this, nullptr);
|
||||||
|
disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr);
|
||||||
|
disconnect(chat.get(), &ChatCore::deleted, this, nullptr);
|
||||||
remove(chat);
|
remove(chat);
|
||||||
// We cannot use countChanged here because it is called before mList
|
|
||||||
// really has removed the item, then emit specific signal
|
|
||||||
emit chatRemoved(chat ? new ChatGui(chat) : nullptr);
|
|
||||||
});
|
});
|
||||||
auto dataChange = [this, chat] {
|
auto dataChange = [this, chat] {
|
||||||
int i = -1;
|
int i = -1;
|
||||||
|
|
@ -94,7 +94,6 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
mModelConnection->invokeToModel([this]() {
|
mModelConnection->invokeToModel([this]() {
|
||||||
mustBeInLinphoneThread(getClassName());
|
mustBeInLinphoneThread(getClassName());
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
mList.clear();
|
|
||||||
// Avoid copy to lambdas
|
// Avoid copy to lambdas
|
||||||
QList<QSharedPointer<ChatCore>> *chats = new QList<QSharedPointer<ChatCore>>();
|
QList<QSharedPointer<ChatCore>> *chats = new QList<QSharedPointer<ChatCore>>();
|
||||||
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
|
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
|
||||||
|
|
@ -118,6 +117,7 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr);
|
disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mList.clear();
|
||||||
for (auto &chat : *chats) {
|
for (auto &chat : *chats) {
|
||||||
connectItem(chat);
|
connectItem(chat);
|
||||||
}
|
}
|
||||||
|
|
@ -143,18 +143,7 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto chatCore = ChatCore::create(room);
|
auto chatCore = ChatCore::create(room);
|
||||||
mModelConnection->invokeToCore([this, chatCore] {
|
addChatInList(chatCore);
|
||||||
auto chatList = getSharedList<ChatCore>();
|
|
||||||
auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer<ChatCore> item) {
|
|
||||||
return item && chatCore && item->getModel() && chatCore->getModel() &&
|
|
||||||
item->getModel()->getMonitor() == chatCore->getModel()->getMonitor();
|
|
||||||
});
|
|
||||||
if (it == chatList.end()) {
|
|
||||||
connectItem(chatCore);
|
|
||||||
add(chatCore);
|
|
||||||
emit chatAdded();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
mModelConnection->makeConnectToModel(&CoreModel::messageReceived,
|
mModelConnection->makeConnectToModel(&CoreModel::messageReceived,
|
||||||
[this, addChatToList](const std::shared_ptr<linphone::Core> &core,
|
[this, addChatToList](const std::shared_ptr<linphone::Core> &core,
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void lUpdate();
|
void lUpdate();
|
||||||
void filterChanged(QString filter);
|
void filterChanged(QString filter);
|
||||||
void chatRemoved(ChatGui *chat);
|
|
||||||
void chatAdded();
|
void chatAdded();
|
||||||
void chatUpdated();
|
void chatUpdated();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,14 @@ ChatProxy::~ChatProxy() {
|
||||||
void ChatProxy::setSourceModel(QAbstractItemModel *model) {
|
void ChatProxy::setSourceModel(QAbstractItemModel *model) {
|
||||||
auto oldChatList = getListModel<ChatList>();
|
auto oldChatList = getListModel<ChatList>();
|
||||||
if (oldChatList) {
|
if (oldChatList) {
|
||||||
disconnect(oldChatList);
|
disconnect(this, &ChatProxy::filterTextChanged, oldChatList, nullptr);
|
||||||
|
disconnect(oldChatList, &ChatList::chatAdded, this, nullptr);
|
||||||
|
disconnect(oldChatList, &ChatList::dataChanged, this, nullptr);
|
||||||
}
|
}
|
||||||
auto newChatList = dynamic_cast<ChatList *>(model);
|
auto newChatList = dynamic_cast<ChatList *>(model);
|
||||||
if (newChatList) {
|
if (newChatList) {
|
||||||
connect(this, &ChatProxy::filterTextChanged, newChatList,
|
connect(this, &ChatProxy::filterTextChanged, newChatList,
|
||||||
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
||||||
connect(newChatList, &ChatList::chatRemoved, this, &ChatProxy::chatRemoved);
|
|
||||||
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
||||||
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
|
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,6 @@ public:
|
||||||
Q_INVOKABLE int findChatIndex(ChatGui *chatGui);
|
Q_INVOKABLE int findChatIndex(ChatGui *chatGui);
|
||||||
Q_INVOKABLE void addChatInList(ChatGui *chatGui);
|
Q_INVOKABLE void addChatInList(ChatGui *chatGui);
|
||||||
|
|
||||||
signals:
|
|
||||||
void chatRemoved(ChatGui *chat);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSharedPointer<ChatList> mList;
|
QSharedPointer<ChatList> mList;
|
||||||
DECLARE_ABSTRACT_OBJECT
|
DECLARE_ABSTRACT_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ void EventLogList::disconnectItem(const QSharedPointer<EventLogCore> &item) {
|
||||||
if (message) {
|
if (message) {
|
||||||
disconnect(message.get(), &ChatMessageCore::isReadChanged, this, nullptr);
|
disconnect(message.get(), &ChatMessageCore::isReadChanged, this, nullptr);
|
||||||
disconnect(message.get(), &ChatMessageCore::deleted, this, nullptr);
|
disconnect(message.get(), &ChatMessageCore::deleted, this, nullptr);
|
||||||
disconnect(message.get(), &ChatMessageCore::ephemeralDurationChanged, this, nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,6 +276,9 @@ void EventLogList::setSelf(QSharedPointer<EventLogList> me) {
|
||||||
}
|
}
|
||||||
setIsUpdating(true);
|
setIsUpdating(true);
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
|
for (auto &event : getSharedList<EventLogCore>()) {
|
||||||
|
disconnectItem(event);
|
||||||
|
}
|
||||||
mList.clear();
|
mList.clear();
|
||||||
if (!mChatCore) {
|
if (!mChatCore) {
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
@ -298,13 +300,6 @@ void EventLogList::setSelf(QSharedPointer<EventLogList> me) {
|
||||||
events->push_back(model);
|
events->push_back(model);
|
||||||
}
|
}
|
||||||
mCoreModelConnection->invokeToCore([this, events] {
|
mCoreModelConnection->invokeToCore([this, events] {
|
||||||
for (auto &event : getSharedList<EventLogCore>()) {
|
|
||||||
auto message = event->getChatMessageCore();
|
|
||||||
if (message) {
|
|
||||||
disconnect(message.get(), &ChatMessageCore::ephemeralDurationChanged, this, nullptr);
|
|
||||||
disconnect(message.get(), &ChatMessageCore::deleted, this, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (auto &event : *events) {
|
for (auto &event : *events) {
|
||||||
connectItem(event);
|
connectItem(event);
|
||||||
mList.append(event);
|
mList.append(event);
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ signals:
|
||||||
private:
|
private:
|
||||||
QString mFilter;
|
QString mFilter;
|
||||||
QSharedPointer<ChatCore> mChatCore;
|
QSharedPointer<ChatCore> mChatCore;
|
||||||
QSharedPointer<SafeConnection<ChatCore, ChatModel>> mChatModelConnection;
|
|
||||||
QSharedPointer<SafeConnection<EventLogList, CoreModel>> mCoreModelConnection;
|
QSharedPointer<SafeConnection<EventLogList, CoreModel>> mCoreModelConnection;
|
||||||
int mDisplayItemsStep = 0;
|
int mDisplayItemsStep = 0;
|
||||||
int mItemsToLoadBeforeSearchResult = 3;
|
int mItemsToLoadBeforeSearchResult = 3;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,11 @@ EventLogProxy::~EventLogProxy() {
|
||||||
void EventLogProxy::setSourceModel(QAbstractItemModel *model) {
|
void EventLogProxy::setSourceModel(QAbstractItemModel *model) {
|
||||||
auto oldEventLogList = getListModel<EventLogList>();
|
auto oldEventLogList = getListModel<EventLogList>();
|
||||||
if (oldEventLogList) {
|
if (oldEventLogList) {
|
||||||
disconnect(oldEventLogList);
|
disconnect(oldEventLogList, &EventLogList::listAboutToBeReset, this, nullptr);
|
||||||
|
disconnect(oldEventLogList, &EventLogList::chatGuiChanged, this, nullptr);
|
||||||
|
disconnect(oldEventLogList, &EventLogList::displayItemsStepChanged, this, nullptr);
|
||||||
|
disconnect(oldEventLogList, &EventLogList::eventInserted, this, nullptr);
|
||||||
|
disconnect(oldEventLogList, &EventLogList::messageWithFilterFound, this, nullptr);
|
||||||
}
|
}
|
||||||
auto newEventLogList = dynamic_cast<EventLogList *>(model);
|
auto newEventLogList = dynamic_cast<EventLogList *>(model);
|
||||||
if (newEventLogList) {
|
if (newEventLogList) {
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,18 @@ void ChatMessageContentCore::setSelf(QSharedPointer<ChatMessageContentCore> me)
|
||||||
});
|
});
|
||||||
|
|
||||||
mChatMessageContentModelConnection->makeConnectToCore(&ChatMessageContentCore::lDownloadFile, [this]() {
|
mChatMessageContentModelConnection->makeConnectToCore(&ChatMessageContentCore::lDownloadFile, [this]() {
|
||||||
mChatMessageContentModelConnection->invokeToModel([this] { mChatMessageContentModel->downloadFile(mName); });
|
mChatMessageContentModelConnection->invokeToModel([this] {
|
||||||
|
QString error;
|
||||||
|
bool downloaded = mChatMessageContentModel->downloadFile(mName, &error);
|
||||||
|
if (!downloaded) {
|
||||||
|
mChatMessageContentModelConnection->invokeToCore([this, &error] {
|
||||||
|
QString message = error;
|
||||||
|
//: Error downloading file %1
|
||||||
|
if (error.isEmpty()) error = tr("download_file_default_error").arg(mName);
|
||||||
|
Utils::showInformationPopup(tr("info_popup_error_titile"), message, false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
mChatMessageContentModelConnection->makeConnectToModel(
|
mChatMessageContentModelConnection->makeConnectToModel(
|
||||||
&ChatMessageContentModel::wasDownloadedChanged,
|
&ChatMessageContentModel::wasDownloadedChanged,
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,8 @@ void ChatMessageContentList::setSelf(QSharedPointer<ChatMessageContentList> me)
|
||||||
|
|
||||||
mModelConnection->makeConnectToCore(&ChatMessageContentList::lUpdate, [this]() {
|
mModelConnection->makeConnectToCore(&ChatMessageContentList::lUpdate, [this]() {
|
||||||
for (auto &content : getSharedList<ChatMessageContentCore>()) {
|
for (auto &content : getSharedList<ChatMessageContentCore>()) {
|
||||||
if (content) disconnect(content.get());
|
if (content) disconnect(content.get(), &ChatMessageContentCore::wasDownloadedChanged, this, nullptr);
|
||||||
|
if (content) disconnect(content.get(), &ChatMessageContentCore::thumbnailChanged, this, nullptr);
|
||||||
}
|
}
|
||||||
if (!mChatMessageCore) return;
|
if (!mChatMessageCore) return;
|
||||||
auto contents = mChatMessageCore->getChatMessageContentList();
|
auto contents = mChatMessageCore->getChatMessageContentList();
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ void ParticipantProxy::setShowMe(const bool &show) {
|
||||||
if (list->mShowMe != show) {
|
if (list->mShowMe != show) {
|
||||||
list->mShowMe = show;
|
list->mShowMe = show;
|
||||||
emit showMeChanged();
|
emit showMeChanged();
|
||||||
invalidateFilter();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ void LimitProxy::setSourceModels(SortFilterProxy *firstList) {
|
||||||
if (secondList) {
|
if (secondList) {
|
||||||
connect(secondList, &QAbstractItemModel::rowsInserted, this, &LimitProxy::onAdded);
|
connect(secondList, &QAbstractItemModel::rowsInserted, this, &LimitProxy::onAdded);
|
||||||
connect(secondList, &QAbstractItemModel::rowsRemoved, this, &LimitProxy::onRemoved);
|
connect(secondList, &QAbstractItemModel::rowsRemoved, this, &LimitProxy::onRemoved);
|
||||||
connect(secondList, &QAbstractItemModel::modelReset, this, &LimitProxy::invalidateRowsFilter);
|
connect(secondList, &QAbstractItemModel::modelReset, this, &LimitProxy::invalidate);
|
||||||
}
|
}
|
||||||
connect(firstList, &SortFilterProxy::filterTextChanged, this, &LimitProxy::filterTextChanged);
|
connect(firstList, &SortFilterProxy::filterTextChanged, this, &LimitProxy::filterTextChanged);
|
||||||
connect(firstList, &SortFilterProxy::filterTypeChanged, this, &LimitProxy::filterTypeChanged);
|
connect(firstList, &SortFilterProxy::filterTypeChanged, this, &LimitProxy::filterTypeChanged);
|
||||||
|
|
@ -60,8 +60,8 @@ void LimitProxy::setSourceModels(SortFilterProxy *firstList) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void LimitProxy::setSourceModels(SortFilterProxy *firstList, QAbstractItemModel *secondList) {
|
void LimitProxy::setSourceModels(SortFilterProxy *firstList, QAbstractItemModel *secondList) {
|
||||||
connect(secondList, &QAbstractItemModel::rowsInserted, this, &LimitProxy::invalidateFilter);
|
connect(secondList, &QAbstractItemModel::rowsInserted, this, &LimitProxy::invalidate);
|
||||||
connect(secondList, &QAbstractItemModel::rowsRemoved, this, &LimitProxy::invalidateFilter);
|
connect(secondList, &QAbstractItemModel::rowsRemoved, this, &LimitProxy::invalidate);
|
||||||
connect(firstList, &SortFilterProxy::filterTextChanged, this, &LimitProxy::filterTextChanged);
|
connect(firstList, &SortFilterProxy::filterTextChanged, this, &LimitProxy::filterTextChanged);
|
||||||
setSourceModel(firstList);
|
setSourceModel(firstList);
|
||||||
}*/
|
}*/
|
||||||
|
|
@ -119,7 +119,7 @@ void LimitProxy::setMaxDisplayItems(int maxItems) {
|
||||||
emit maxDisplayItemsChanged();
|
emit maxDisplayItemsChanged();
|
||||||
|
|
||||||
if (model && getDisplayCount(modelCount) != oldCount) {
|
if (model && getDisplayCount(modelCount) != oldCount) {
|
||||||
invalidateFilter();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -178,6 +178,6 @@ void LimitProxy::onAdded() {
|
||||||
void LimitProxy::onRemoved() {
|
void LimitProxy::onRemoved() {
|
||||||
int count = sourceModel()->rowCount();
|
int count = sourceModel()->rowCount();
|
||||||
if (mMaxDisplayItems > 0 && mMaxDisplayItems <= count) {
|
if (mMaxDisplayItems > 0 && mMaxDisplayItems <= count) {
|
||||||
invalidateFilter();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,5 +90,6 @@ void SortFilterProxy::remove(int index, int count) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SortFilterProxy::invalidateFilter() {
|
void SortFilterProxy::invalidateFilter() {
|
||||||
QSortFilterProxyModel::invalidateFilter();
|
// TODO : replace by begin/endFilterChanged when ci uses Qt6.10
|
||||||
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -74,8 +74,12 @@ void ChatMessageContentModel::removeDownloadedFile(QString filePath) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatMessageContentModel::downloadFile(const QString &name) {
|
bool ChatMessageContentModel::downloadFile(const QString &name, QString *error) {
|
||||||
if (!mChatMessageModel) return;
|
if (!mChatMessageModel) {
|
||||||
|
//: Internal error : message object does not exist anymore !
|
||||||
|
if (error) *error = tr("download_error_object_doesnt_exist");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
switch (mChatMessageModel->getState()) {
|
switch (mChatMessageModel->getState()) {
|
||||||
case linphone::ChatMessage::State::Delivered:
|
case linphone::ChatMessage::State::Delivered:
|
||||||
case linphone::ChatMessage::State::DeliveredToUser:
|
case linphone::ChatMessage::State::DeliveredToUser:
|
||||||
|
|
@ -83,10 +87,13 @@ void ChatMessageContentModel::downloadFile(const QString &name) {
|
||||||
case linphone::ChatMessage::State::FileTransferDone:
|
case linphone::ChatMessage::State::FileTransferDone:
|
||||||
break;
|
break;
|
||||||
case linphone::ChatMessage::State::FileTransferInProgress:
|
case linphone::ChatMessage::State::FileTransferInProgress:
|
||||||
return;
|
return true;
|
||||||
default:
|
default:
|
||||||
lWarning() << QStringLiteral("Wrong message state when requesting downloading, state=.")
|
auto state = LinphoneEnums::fromLinphone(mChatMessageModel->getState());
|
||||||
<< LinphoneEnums::fromLinphone(mChatMessageModel->getState());
|
lWarning() << QStringLiteral("Wrong message state when requesting downloading, state=") << state;
|
||||||
|
//: Wrong message state when requesting downloading, state = %1
|
||||||
|
if (error) *error = tr("download_file_error_wrong_state").arg(LinphoneEnums::toString(state));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
bool soFarSoGood;
|
bool soFarSoGood;
|
||||||
const QString safeFilePath = Utils::getSafeFilePath(
|
const QString safeFilePath = Utils::getSafeFilePath(
|
||||||
|
|
@ -94,21 +101,26 @@ void ChatMessageContentModel::downloadFile(const QString &name) {
|
||||||
|
|
||||||
if (!soFarSoGood) {
|
if (!soFarSoGood) {
|
||||||
lWarning() << QStringLiteral("Unable to create safe file path for: %1.").arg(name);
|
lWarning() << QStringLiteral("Unable to create safe file path for: %1.").arg(name);
|
||||||
return;
|
//: Unable to create safe file path for: %1
|
||||||
|
if (error) *error = tr("download_file_error_no_safe_file_path").arg(name);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
mContent->setFilePath(Utils::appStringToCoreString(safeFilePath));
|
mContent->setFilePath(Utils::appStringToCoreString(safeFilePath));
|
||||||
|
|
||||||
if (!mContent->isFileTransfer()) {
|
if (!mContent->isFileTransfer()) {
|
||||||
lWarning() << QStringLiteral("file transfer is not available");
|
lWarning() << QStringLiteral("file transfer is not available");
|
||||||
Utils::showInformationPopup(
|
//: This file was already downloaded and is no more on the server. Your peer have to resend it if you want
|
||||||
//: Error
|
//: to get it
|
||||||
tr("popup_error_title"),
|
if (error) *error = tr("download_file_error_file_transfer_unavailable");
|
||||||
//: This file was already downloaded and is no more on the server. Your peer have to resend it if you want
|
return false;
|
||||||
//: to get it
|
|
||||||
tr("popup_download_error_message"), false);
|
|
||||||
} else {
|
} else {
|
||||||
if (!mChatMessageModel->getMonitor()->downloadContent(mContent))
|
auto downloaded = mChatMessageModel->getMonitor()->downloadContent(mContent);
|
||||||
|
if (!downloaded && error) {
|
||||||
lWarning() << QStringLiteral("Unable to download file of entry %1.").arg(name);
|
lWarning() << QStringLiteral("Unable to download file of entry %1.").arg(name);
|
||||||
|
//: Unable to download file of entry %1
|
||||||
|
*error = tr("download_file_error_unable_to_download").arg(name);
|
||||||
|
}
|
||||||
|
return downloaded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,21 @@ public:
|
||||||
std::shared_ptr<ChatMessageModel> chatMessageModel);
|
std::shared_ptr<ChatMessageModel> chatMessageModel);
|
||||||
~ChatMessageContentModel();
|
~ChatMessageContentModel();
|
||||||
|
|
||||||
QString getThumbnail() const;
|
|
||||||
|
|
||||||
void setThumbnail(const QString &data);
|
void setThumbnail(const QString &data);
|
||||||
void setWasDownloaded(bool wasDownloaded);
|
void setWasDownloaded(bool wasDownloaded);
|
||||||
|
|
||||||
void createThumbnail();
|
void createThumbnail();
|
||||||
void removeDownloadedFile(QString filePath);
|
void removeDownloadedFile(QString filePath);
|
||||||
|
|
||||||
void downloadFile(const QString &name);
|
/**
|
||||||
|
* Returns true if download succeed, false otherwise
|
||||||
|
*/
|
||||||
|
bool downloadFile(const QString &name, QString *error = nullptr);
|
||||||
void cancelDownloadFile();
|
void cancelDownloadFile();
|
||||||
void openFile(const QString &name, bool wasDownloaded, bool showDirectory = false);
|
void openFile(const QString &name, bool wasDownloaded, bool showDirectory = false);
|
||||||
|
/**
|
||||||
|
* Returns true if file saved successfully, false otherwise
|
||||||
|
*/
|
||||||
bool saveAs(const QString &path);
|
bool saveAs(const QString &path);
|
||||||
|
|
||||||
const std::shared_ptr<linphone::Content> &getContent() const;
|
const std::shared_ptr<linphone::Content> &getContent() const;
|
||||||
|
|
@ -70,4 +74,4 @@ private:
|
||||||
QSharedPointer<ConferenceInfoModel> mConferenceInfoModel;
|
QSharedPointer<ConferenceInfoModel> mConferenceInfoModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,9 @@ LinphoneEnums::ChatMessageState LinphoneEnums::fromLinphone(const linphone::Chat
|
||||||
|
|
||||||
QString LinphoneEnums::toString(const LinphoneEnums::ChatMessageState &data) {
|
QString LinphoneEnums::toString(const LinphoneEnums::ChatMessageState &data) {
|
||||||
switch (data) {
|
switch (data) {
|
||||||
|
case LinphoneEnums::ChatMessageState::StateIdle:
|
||||||
|
//: "idle"
|
||||||
|
return QObject::tr("message_state_idle");
|
||||||
case LinphoneEnums::ChatMessageState::StateInProgress:
|
case LinphoneEnums::ChatMessageState::StateInProgress:
|
||||||
//: "delivery in progress"
|
//: "delivery in progress"
|
||||||
return QObject::tr("message_state_in_progress");
|
return QObject::tr("message_state_in_progress");
|
||||||
|
|
|
||||||
|
|
@ -269,11 +269,14 @@ VariantObject *Utils::haveAccount() {
|
||||||
|
|
||||||
void Utils::smartShowWindow(QQuickWindow *window) {
|
void Utils::smartShowWindow(QQuickWindow *window) {
|
||||||
if (!window) return;
|
if (!window) return;
|
||||||
if (window->visibility() == QWindow::Maximized) // Avoid to change visibility mode
|
// if (window->visibility() == QWindow::Maximized) // Avoid to change visibility mode
|
||||||
window->showMaximized();
|
// window->showMaximized();
|
||||||
else window->show();
|
lInfo() << "[Utils] : show window" << window;
|
||||||
|
window->show();
|
||||||
App::getInstance()->setLastActiveWindow(window);
|
App::getInstance()->setLastActiveWindow(window);
|
||||||
|
lInfo() << "[Utils] : raise window" << window;
|
||||||
window->raise(); // Raise ensure to get focus on Mac
|
window->raise(); // Raise ensure to get focus on Mac
|
||||||
|
lInfo() << "[Utils] : request activate";
|
||||||
window->requestActivate();
|
window->requestActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ ListView {
|
||||||
onModelAboutToBeReset: {
|
onModelAboutToBeReset: {
|
||||||
loading = true
|
loading = true
|
||||||
}
|
}
|
||||||
onChatRemoved: {
|
onRowsRemoved: {
|
||||||
var currentChat = model.getAt(currentIndex)
|
var index = mainItem.currentIndex
|
||||||
mainItem.currentIndex = -1
|
mainItem.currentIndex = -1
|
||||||
selectChat(currentChat)
|
mainItem.currentIndex = index
|
||||||
}
|
}
|
||||||
onLayoutChanged: {
|
onLayoutChanged: {
|
||||||
selectChat(mainItem.currentChatGui)
|
selectChat(mainItem.currentChatGui)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ Image {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
property ChatMessageContentGui contentGui
|
property ChatMessageContentGui contentGui
|
||||||
|
|
||||||
|
RectangleTest{anchors.fill: parent}
|
||||||
|
|
||||||
mipmap: false//SettingsModel.mipmapEnabled
|
mipmap: false//SettingsModel.mipmapEnabled
|
||||||
autoTransform: true
|
autoTransform: true
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
|
@ -53,4 +55,4 @@ Image {
|
||||||
mainItem.contentGui.core.lOpenFile()
|
mainItem.contentGui.core.lOpenFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,9 +317,7 @@ ListView {
|
||||||
visible: itemDelegate.haveModel
|
visible: itemDelegate.haveModel
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: (mouse) => {
|
onClicked: (mouse) => {
|
||||||
console.log("clicked", mouse.button)
|
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
console.log("open popup")
|
|
||||||
deletePopup.x = mouse.x
|
deletePopup.x = mouse.x
|
||||||
deletePopup.y = mouse.y
|
deletePopup.y = mouse.y
|
||||||
deletePopup.open()
|
deletePopup.open()
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ FocusScope {
|
||||||
font {
|
font {
|
||||||
pixelSize: Typography.h4.pixelSize
|
pixelSize: Typography.h4.pixelSize
|
||||||
weight: Utils.getSizeWithScreenRatio(400)
|
weight: Utils.getSizeWithScreenRatio(400)
|
||||||
capitalization: Font.Capitalize
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
@ -310,7 +309,7 @@ FocusScope {
|
||||||
Control.Control {
|
Control.Control {
|
||||||
id: participantListPopup
|
id: participantListPopup
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.min(participantInfoList.height, Utils.getSizeWithScreenRatio(200))
|
height: visible ? Math.min(participantInfoList.height, Utils.getSizeWithScreenRatio(200)) : 0
|
||||||
visible: false
|
visible: false
|
||||||
anchors.bottom: chatMessagesListView.bottom
|
anchors.bottom: chatMessagesListView.bottom
|
||||||
anchors.left: chatMessagesListView.left
|
anchors.left: chatMessagesListView.left
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ ColumnLayout{
|
||||||
property var popupId
|
property var popupId
|
||||||
Component{
|
Component{
|
||||||
id: contactDelegate
|
id: contactDelegate
|
||||||
Contact{
|
Contact {
|
||||||
id: contactItem
|
id: contactItem
|
||||||
Layout.preferredWidth: mainItem.childrenWidth
|
Layout.preferredWidth: mainItem.childrenWidth
|
||||||
account: modelData
|
account: modelData
|
||||||
|
|
|
||||||
|
|
@ -391,4 +391,4 @@ AbstractMainPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1215,11 +1215,11 @@ AbstractWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onJoinConfRequested: uri => {
|
onJoinConfRequested: uri => {
|
||||||
mainWindow.joinConference(uri, {
|
mainWindow.joinConference(uri, {
|
||||||
"microEnabled": microEnabled,
|
"microEnabled": microEnabled,
|
||||||
"localVideoEnabled": localVideoEnabled
|
"localVideoEnabled": localVideoEnabled
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onCancelJoiningRequested: mainWindow.cancelJoinConference()
|
onCancelJoiningRequested: mainWindow.cancelJoinConference()
|
||||||
onCancelAfterJoinRequested: mainWindow.cancelAfterJoin()
|
onCancelAfterJoinRequested: mainWindow.cancelAfterJoin()
|
||||||
}
|
}
|
||||||
|
|
@ -1734,4 +1734,4 @@ AbstractWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue