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());
|
return !defaultModerators_.contains(index.data(Role::URI).toString());
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case SmartListModel::Type::ADDCONVMEMBER:
|
||||||
|
selectableProxyModel_->setPredicate([](const QModelIndex& index, const QRegExp&) {
|
||||||
|
return index.data(Role::IsCoreDialog).toBool();
|
||||||
|
});
|
||||||
|
break;
|
||||||
case SmartListModel::Type::CONFERENCE:
|
case SmartListModel::Type::CONFERENCE:
|
||||||
selectableProxyModel_->setPredicate([](const QModelIndex& index, const QRegularExpression&) {
|
selectableProxyModel_->setPredicate([](const QModelIndex& index, const QRegularExpression&) {
|
||||||
return index.data(Role::Presence).toBool();
|
return index.data(Role::Presence).toBool();
|
||||||
|
@ -102,6 +106,16 @@ ContactAdapter::setSearchFilter(const QString& filter)
|
||||||
return (!defaultModerators_.contains(index.data(Role::URI).toString())
|
return (!defaultModerators_.contains(index.data(Role::URI).toString())
|
||||||
&& index.data(Role::Title).toString().contains(filter));
|
&& 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(
|
selectableProxyModel_->setFilterRegularExpression(
|
||||||
QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
|
QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
|
||||||
|
@ -112,10 +126,16 @@ ContactAdapter::contactSelected(int index)
|
||||||
{
|
{
|
||||||
auto contactIndex = selectableProxyModel_->index(index, 0);
|
auto contactIndex = selectableProxyModel_->index(index, 0);
|
||||||
auto* callModel = lrcInstance_->getCurrentCallModel();
|
auto* callModel = lrcInstance_->getCurrentCallModel();
|
||||||
|
auto* convModel = lrcInstance_->getCurrentConversationModel();
|
||||||
const auto& convInfo = lrcInstance_->getConversationFromConvUid(
|
const auto& convInfo = lrcInstance_->getConversationFromConvUid(
|
||||||
lrcInstance_->get_selectedConvUid());
|
lrcInstance_->get_selectedConvUid());
|
||||||
if (contactIndex.isValid()) {
|
if (contactIndex.isValid()) {
|
||||||
switch (listModeltype_) {
|
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: {
|
case SmartListModel::Type::CONFERENCE: {
|
||||||
// Conference.
|
// Conference.
|
||||||
const auto sectionName = contactIndex.data(Role::SectionName).value<QString>();
|
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 net.jami.Adapters 1.1
|
||||||
|
|
||||||
import "../../commoncomponents"
|
import "../../commoncomponents"
|
||||||
|
import "../js/contactpickercreation.js" as ContactPickerCreation
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
@ -49,8 +50,17 @@ Rectangle {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property bool addMemberVisibility: {
|
||||||
|
return !CurrentConversation.isCoreDialog && CurrentConversation.isSwarm
|
||||||
|
}
|
||||||
|
|
||||||
color: JamiTheme.chatviewBgColor
|
color: JamiTheme.chatviewBgColor
|
||||||
|
|
||||||
|
function addToConversationClicked() {
|
||||||
|
ContactPickerCreation.createContactPickerObjects(ContactList.ADDCONVMEMBER, root)
|
||||||
|
ContactPickerCreation.openContactPicker()
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: messagingHeaderRectRowLayout
|
id: messagingHeaderRectRowLayout
|
||||||
|
|
||||||
|
@ -140,7 +150,7 @@ Rectangle {
|
||||||
PushButton {
|
PushButton {
|
||||||
id: startAAudioCallButton
|
id: startAAudioCallButton
|
||||||
|
|
||||||
visible: interactionButtonsVisibility
|
visible: interactionButtonsVisibility && !addMemberVisibility
|
||||||
|
|
||||||
source: JamiResources.place_audiocall_24dp_svg
|
source: JamiResources.place_audiocall_24dp_svg
|
||||||
toolTipText: JamiStrings.placeAudioCall
|
toolTipText: JamiStrings.placeAudioCall
|
||||||
|
@ -154,8 +164,7 @@ Rectangle {
|
||||||
PushButton {
|
PushButton {
|
||||||
id: startAVideoCallButton
|
id: startAVideoCallButton
|
||||||
|
|
||||||
visible: CurrentAccount.videoEnabled_Video && interactionButtonsVisibility
|
visible: CurrentAccount.videoEnabled_Video && interactionButtonsVisibility && !addMemberVisibility
|
||||||
|
|
||||||
source: JamiResources.videocam_24dp_svg
|
source: JamiResources.videocam_24dp_svg
|
||||||
toolTipText: JamiStrings.placeVideoCall
|
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 {
|
PushButton {
|
||||||
id: selectPluginButton
|
id: selectPluginButton
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ Popup {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case ContactList.CONFERENCE:
|
case ContactList.CONFERENCE:
|
||||||
return qsTr("Add to conference")
|
return qsTr("Add to conference")
|
||||||
|
case ContactList.ADDCONVMEMBER:
|
||||||
|
return qsTr("Add to conversation")
|
||||||
case ContactList.TRANSFER:
|
case ContactList.TRANSFER:
|
||||||
return qsTr("Transfer this call")
|
return qsTr("Transfer this call")
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -39,7 +39,7 @@ SmartListModel::SmartListModel(QObject* parent,
|
||||||
{
|
{
|
||||||
if (listModelType_ == Type::CONFERENCE) {
|
if (listModelType_ == Type::CONFERENCE) {
|
||||||
setConferenceableFilter();
|
setConferenceableFilter();
|
||||||
} else if (listModelType_ == Type::CONVERSATION) {
|
} else if (listModelType_ == Type::CONVERSATION || listModelType_ == Type::ADDCONVMEMBER) {
|
||||||
fillConversationsList();
|
fillConversationsList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,6 +131,7 @@ SmartListModel::data(const QModelIndex& index, int role) const
|
||||||
auto& item = lrcInstance_->getConversationFromConvUid(itemConvUid, itemAccountId);
|
auto& item = lrcInstance_->getConversationFromConvUid(itemConvUid, itemAccountId);
|
||||||
return dataForItem(item, role);
|
return dataForItem(item, role);
|
||||||
} break;
|
} break;
|
||||||
|
case Type::ADDCONVMEMBER:
|
||||||
case Type::CONVERSATION: {
|
case Type::CONVERSATION: {
|
||||||
auto& item = conversations_.at(index.row());
|
auto& item = conversations_.at(index.row());
|
||||||
return dataForItem(item, role);
|
return dataForItem(item, role);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
namespace ContactList {
|
namespace ContactList {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
enum Type { CONVERSATION, CONFERENCE, TRANSFER, COUNT__ };
|
enum Type { CONVERSATION, CONFERENCE, TRANSFER, ADDCONVMEMBER, COUNT__ };
|
||||||
Q_ENUM_NS(Type)
|
Q_ENUM_NS(Type)
|
||||||
} // namespace ContactList
|
} // namespace ContactList
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue