mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00
chatviewheader: prepare interface for small groups
GitLab: #340 Change-Id: Ic3fe3c6d317f2af485b79414242e7be86d5f820d
This commit is contained in:
parent
866da95252
commit
7b1fd8a3fe
5 changed files with 52 additions and 6 deletions
|
@ -54,7 +54,11 @@ ContactAdapter::getContactSelectableModel(int type)
|
|||
return !defaultModerators_.contains(index.data(Role::URI).toString());
|
||||
});
|
||||
break;
|
||||
|
||||
case SmartListModel::Type::ADDCONVMEMBER:
|
||||
selectableProxyModel_->setPredicate([](const QModelIndex& index, const QRegExp&) {
|
||||
return index.data(Role::IsCoreDialog).toBool();
|
||||
});
|
||||
break;
|
||||
case SmartListModel::Type::CONFERENCE:
|
||||
selectableProxyModel_->setPredicate([](const QModelIndex& index, const QRegularExpression&) {
|
||||
return index.data(Role::Presence).toBool();
|
||||
|
@ -102,6 +106,16 @@ ContactAdapter::setSearchFilter(const QString& filter)
|
|||
return (!defaultModerators_.contains(index.data(Role::URI).toString())
|
||||
&& index.data(Role::Title).toString().contains(filter));
|
||||
});
|
||||
} else if (listModeltype_ == SmartListModel::Type::ADDCONVMEMBER) {
|
||||
selectableProxyModel_->setPredicate(
|
||||
[this, filter](const QModelIndex& index, const QRegExp&) {
|
||||
return (index.data(Role::Title).toString().contains(filter, Qt::CaseInsensitive)
|
||||
|| index.data(Role::RegisteredName)
|
||||
.toString()
|
||||
.contains(filter, Qt::CaseInsensitive)
|
||||
|| index.data(Role::URI).toString().contains(filter, Qt::CaseInsensitive))
|
||||
&& index.data(Role::IsCoreDialog).toBool();
|
||||
});
|
||||
}
|
||||
selectableProxyModel_->setFilterRegularExpression(
|
||||
QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
|
||||
|
@ -112,10 +126,16 @@ ContactAdapter::contactSelected(int index)
|
|||
{
|
||||
auto contactIndex = selectableProxyModel_->index(index, 0);
|
||||
auto* callModel = lrcInstance_->getCurrentCallModel();
|
||||
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
||||
const auto& convInfo = lrcInstance_->getConversationFromConvUid(
|
||||
lrcInstance_->get_selectedConvUid());
|
||||
if (contactIndex.isValid()) {
|
||||
switch (listModeltype_) {
|
||||
case SmartListModel::Type::ADDCONVMEMBER: {
|
||||
const auto uri = contactIndex.data(Role::URI).value<QString>();
|
||||
convModel->addConversationMember(lrcInstance_->get_selectedConvUid(), uri);
|
||||
break;
|
||||
}
|
||||
case SmartListModel::Type::CONFERENCE: {
|
||||
// Conference.
|
||||
const auto sectionName = contactIndex.data(Role::SectionName).value<QString>();
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.jami.Constants 1.1
|
|||
import net.jami.Adapters 1.1
|
||||
|
||||
import "../../commoncomponents"
|
||||
import "../js/contactpickercreation.js" as ContactPickerCreation
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
@ -49,8 +50,17 @@ Rectangle {
|
|||
return true
|
||||
}
|
||||
|
||||
property bool addMemberVisibility: {
|
||||
return !CurrentConversation.isCoreDialog && CurrentConversation.isSwarm
|
||||
}
|
||||
|
||||
color: JamiTheme.chatviewBgColor
|
||||
|
||||
function addToConversationClicked() {
|
||||
ContactPickerCreation.createContactPickerObjects(ContactList.ADDCONVMEMBER, root)
|
||||
ContactPickerCreation.openContactPicker()
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: messagingHeaderRectRowLayout
|
||||
|
||||
|
@ -140,7 +150,7 @@ Rectangle {
|
|||
PushButton {
|
||||
id: startAAudioCallButton
|
||||
|
||||
visible: interactionButtonsVisibility
|
||||
visible: interactionButtonsVisibility && !addMemberVisibility
|
||||
|
||||
source: JamiResources.place_audiocall_24dp_svg
|
||||
toolTipText: JamiStrings.placeAudioCall
|
||||
|
@ -154,8 +164,7 @@ Rectangle {
|
|||
PushButton {
|
||||
id: startAVideoCallButton
|
||||
|
||||
visible: CurrentAccount.videoEnabled_Video && interactionButtonsVisibility
|
||||
|
||||
visible: CurrentAccount.videoEnabled_Video && interactionButtonsVisibility && !addMemberVisibility
|
||||
source: JamiResources.videocam_24dp_svg
|
||||
toolTipText: JamiStrings.placeVideoCall
|
||||
|
||||
|
@ -167,6 +176,20 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
PushButton {
|
||||
id: addParticipantsButton
|
||||
|
||||
visible: addMemberVisibility
|
||||
|
||||
source: JamiResources.add_people_24dp_svg
|
||||
toolTipText: JamiStrings.addParticipants
|
||||
|
||||
normalColor: JamiTheme.chatviewBgColor
|
||||
imageColor: JamiTheme.chatviewButtonColor
|
||||
|
||||
onClicked: root.addToConversationClicked()
|
||||
}
|
||||
|
||||
PushButton {
|
||||
id: selectPluginButton
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ Popup {
|
|||
switch(type) {
|
||||
case ContactList.CONFERENCE:
|
||||
return qsTr("Add to conference")
|
||||
case ContactList.ADDCONVMEMBER:
|
||||
return qsTr("Add to conversation")
|
||||
case ContactList.TRANSFER:
|
||||
return qsTr("Transfer this call")
|
||||
default:
|
||||
|
|
|
@ -39,7 +39,7 @@ SmartListModel::SmartListModel(QObject* parent,
|
|||
{
|
||||
if (listModelType_ == Type::CONFERENCE) {
|
||||
setConferenceableFilter();
|
||||
} else if (listModelType_ == Type::CONVERSATION) {
|
||||
} else if (listModelType_ == Type::CONVERSATION || listModelType_ == Type::ADDCONVMEMBER) {
|
||||
fillConversationsList();
|
||||
}
|
||||
}
|
||||
|
@ -131,6 +131,7 @@ SmartListModel::data(const QModelIndex& index, int role) const
|
|||
auto& item = lrcInstance_->getConversationFromConvUid(itemConvUid, itemAccountId);
|
||||
return dataForItem(item, role);
|
||||
} break;
|
||||
case Type::ADDCONVMEMBER:
|
||||
case Type::CONVERSATION: {
|
||||
auto& item = conversations_.at(index.row());
|
||||
return dataForItem(item, role);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace ContactList {
|
||||
Q_NAMESPACE
|
||||
enum Type { CONVERSATION, CONFERENCE, TRANSFER, COUNT__ };
|
||||
enum Type { CONVERSATION, CONFERENCE, TRANSFER, ADDCONVMEMBER, COUNT__ };
|
||||
Q_ENUM_NS(Type)
|
||||
} // namespace ContactList
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue