mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 14:55:43 +02:00
video-split: follow up patch
+ Finish layout fixing + Clean warning + protect elements + update copyrights GitLab: #476 Change-Id: Ib3270b5d37d63aa99a576d48574b62801df37258
This commit is contained in:
parent
573f62d2c7
commit
3debb09740
20 changed files with 150 additions and 124 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 by Savoir-faire Linux
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||||
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -37,6 +37,7 @@ CallParticipantsModel::rowCount(const QModelIndex& parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
// Internal call, so no need to protect participants_ as locked higher
|
||||||
return participants_.size();
|
return participants_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ CallParticipantsModel::data(const QModelIndex& index, int role) const
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
using namespace CallParticipant;
|
using namespace CallParticipant;
|
||||||
|
// Internal call, so no need to protect participants_ as locked higher
|
||||||
auto participant = participants_.at(index.row());
|
auto participant = participants_.at(index.row());
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
|
@ -96,6 +98,7 @@ CallParticipantsModel::roleNames() const
|
||||||
void
|
void
|
||||||
CallParticipantsModel::addParticipant(int index, const QVariant& infos)
|
CallParticipantsModel::addParticipant(int index, const QVariant& infos)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(participantsMtx_);
|
||||||
if (index > participants_.size())
|
if (index > participants_.size())
|
||||||
return;
|
return;
|
||||||
beginInsertRows(QModelIndex(), index, index);
|
beginInsertRows(QModelIndex(), index, index);
|
||||||
|
@ -111,18 +114,22 @@ CallParticipantsModel::addParticipant(int index, const QVariant& infos)
|
||||||
void
|
void
|
||||||
CallParticipantsModel::updateParticipant(int index, const QVariant& infos)
|
CallParticipantsModel::updateParticipant(int index, const QVariant& infos)
|
||||||
{
|
{
|
||||||
if (participants_.size() <= index)
|
{
|
||||||
return;
|
std::lock_guard<std::mutex> lk(participantsMtx_);
|
||||||
auto it = participants_.begin() + index;
|
if (participants_.size() <= index)
|
||||||
(*it) = CallParticipant::Item {infos.toJsonObject()};
|
return;
|
||||||
|
auto it = participants_.begin() + index;
|
||||||
|
(*it) = CallParticipant::Item {infos.toJsonObject()};
|
||||||
|
|
||||||
callId_ = participants_[index].item["callId"].toString();
|
callId_ = participants_[index].item["callId"].toString();
|
||||||
|
}
|
||||||
Q_EMIT dataChanged(createIndex(index, 0), createIndex(index, 0));
|
Q_EMIT dataChanged(createIndex(index, 0), createIndex(index, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CallParticipantsModel::removeParticipant(int index)
|
CallParticipantsModel::removeParticipant(int index)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(participantsMtx_);
|
||||||
if (participants_.size() <= index)
|
if (participants_.size() <= index)
|
||||||
return;
|
return;
|
||||||
callId_ = participants_[index].item["callId"].toString();
|
callId_ = participants_[index].item["callId"].toString();
|
||||||
|
@ -140,13 +147,17 @@ CallParticipantsModel::setParticipants(const QString& callId, const QVariantList
|
||||||
{
|
{
|
||||||
callId_ = callId;
|
callId_ = callId;
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lk(participantsMtx_);
|
||||||
participants_.clear();
|
participants_.clear();
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
if (!participants.isEmpty()) {
|
if (!participants.isEmpty()) {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (const auto& participant : participants) {
|
for (const auto& participant : participants) {
|
||||||
addParticipant(idx, participant);
|
beginInsertRows(QModelIndex(), idx, idx);
|
||||||
|
auto it = participants_.begin() + idx;
|
||||||
|
participants_.insert(it, CallParticipant::Item {participant.toJsonObject()});
|
||||||
|
endInsertRows();
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 by Savoir-faire Linux
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||||
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -178,6 +178,7 @@ Q_SIGNALS:
|
||||||
private:
|
private:
|
||||||
LRCInstance* lrcInstance_ {nullptr};
|
LRCInstance* lrcInstance_ {nullptr};
|
||||||
|
|
||||||
|
std::mutex participantsMtx_;
|
||||||
QList<CallParticipant::Item> participants_ {};
|
QList<CallParticipant::Item> participants_ {};
|
||||||
QString callId_;
|
QString callId_;
|
||||||
LayoutType layout_;
|
LayoutType layout_;
|
||||||
|
|
|
@ -42,7 +42,7 @@ Column {
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
width: childrenRect.width + 12
|
width: childrenRect.width
|
||||||
height: JamiTheme.contactMessageAvatarSize + 12
|
height: JamiTheme.contactMessageAvatarSize + 12
|
||||||
radius: JamiTheme.contactMessageAvatarSize / 2 + 6
|
radius: JamiTheme.contactMessageAvatarSize / 2 + 6
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ Column {
|
||||||
border.color: CurrentConversation.isCoreDialog ? JamiTheme.messageInBgColor : CurrentConversation.color
|
border.color: CurrentConversation.isCoreDialog ? JamiTheme.messageInBgColor : CurrentConversation.color
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
|
|
||||||
Avatar {
|
Avatar {
|
||||||
|
Layout.leftMargin: 6
|
||||||
|
|
||||||
width: JamiTheme.contactMessageAvatarSize
|
width: JamiTheme.contactMessageAvatarSize
|
||||||
height: JamiTheme.contactMessageAvatarSize
|
height: JamiTheme.contactMessageAvatarSize
|
||||||
visible: ActionUri !== ""
|
visible: ActionUri !== ""
|
||||||
|
@ -66,6 +66,8 @@ Column {
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
Layout.rightMargin: 6
|
||||||
|
|
||||||
id: textLabel
|
id: textLabel
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: Body
|
text: Body
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 by Savoir-faire Linux
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||||
* Author: Sébastien blin <sebastien.blin@savoirfairelinux.com>
|
* Author: Sébastien blin <sebastien.blin@savoirfairelinux.com>
|
||||||
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -77,15 +77,16 @@ CurrentConversation::updateData()
|
||||||
// It can be used to display add contact/conversation UI and
|
// It can be used to display add contact/conversation UI and
|
||||||
// is consistently determined by the peer's uri being equal to
|
// is consistently determined by the peer's uri being equal to
|
||||||
// the conversation id.
|
// the conversation id.
|
||||||
set_isTemporary(isCoreDialog_ ? convId == uris_.at(0) : false);
|
auto members = accInfo.conversationModel->peersForConversation(convId);
|
||||||
|
set_isTemporary(isCoreDialog_ ? convId == members.at(0) : false);
|
||||||
|
|
||||||
auto isContact {false};
|
auto isContact {false};
|
||||||
if (isCoreDialog_)
|
if (isCoreDialog_)
|
||||||
try {
|
try {
|
||||||
auto& contact = accInfo.contactModel->getContact(uris_.at(0));
|
auto& contact = accInfo.contactModel->getContact(members.at(0));
|
||||||
isContact = contact.profileInfo.type != profile::Type::TEMPORARY;
|
isContact = contact.profileInfo.type != profile::Type::TEMPORARY;
|
||||||
} catch (...) {
|
} catch (const std::exception& e) {
|
||||||
qInfo() << "Contact not found";
|
qInfo() << "Contact not found: " << e.what();
|
||||||
}
|
}
|
||||||
set_isContact(isContact);
|
set_isContact(isContact);
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ MainApplication::handleUriAction(const QString& arg)
|
||||||
if (arg.isEmpty() && !runOptions_[Option::StartUri].isNull()) {
|
if (arg.isEmpty() && !runOptions_[Option::StartUri].isNull()) {
|
||||||
uri = runOptions_[Option::StartUri].toString();
|
uri = runOptions_[Option::StartUri].toString();
|
||||||
qDebug() << "URI action invoked by run option" << uri;
|
qDebug() << "URI action invoked by run option" << uri;
|
||||||
} else {
|
} else if (!arg.isEmpty()) {
|
||||||
uri = arg;
|
uri = arg;
|
||||||
qDebug() << "URI action invoked by secondary instance" << uri;
|
qDebug() << "URI action invoked by secondary instance" << uri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,8 @@ Label {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
id: background
|
id: background
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
implicitWidth: root.width
|
|
||||||
implicitHeight: root.height
|
|
||||||
color: root.popup.opened ?
|
color: root.popup.opened ?
|
||||||
Qt.lighter(JamiTheme.hoverColor, 1.0) :
|
Qt.lighter(JamiTheme.hoverColor, 1.0) :
|
||||||
mouseArea.containsMouse ?
|
mouseArea.containsMouse ?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 by Savoir-faire Linux
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||||
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -69,7 +69,7 @@ Rectangle {
|
||||||
enabled: visible
|
enabled: visible
|
||||||
target: CurrentConversation
|
target: CurrentConversation
|
||||||
|
|
||||||
onUrisChanged: {
|
function onUrisChanged(uris) {
|
||||||
model = ContactAdapter.getContactSelectableModel(type)
|
model = ContactAdapter.getContactSelectableModel(type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,11 +169,11 @@ Control {
|
||||||
var muteState = CallAdapter.getMuteState(CurrentAccount.uri)
|
var muteState = CallAdapter.getMuteState(CurrentAccount.uri)
|
||||||
var modMuted = muteState === CallAdapter.MODERATOR_MUTED
|
var modMuted = muteState === CallAdapter.MODERATOR_MUTED
|
||||||
|| muteState === CallAdapter.BOTH_MUTED
|
|| muteState === CallAdapter.BOTH_MUTED
|
||||||
if (isAudioMuted && modMuted) {
|
if (muteAudioAction.checked && modMuted) {
|
||||||
muteAlertActive = true
|
muteAlertActive = true
|
||||||
muteAlertMessage = JamiStrings.participantModIsStillMuted
|
muteAlertMessage = JamiStrings.participantModIsStillMuted
|
||||||
}
|
}
|
||||||
CallAdapter.muteThisCallToggle(!isAudioMuted)
|
CallAdapter.muteThisCallToggle(!muteAudioAction.checked)
|
||||||
}
|
}
|
||||||
checkable: true
|
checkable: true
|
||||||
icon.source: checked ?
|
icon.source: checked ?
|
||||||
|
|
|
@ -86,8 +86,8 @@ Rectangle {
|
||||||
Connections {
|
Connections {
|
||||||
target: CurrentConversation
|
target: CurrentConversation
|
||||||
|
|
||||||
onUrisChanged: {
|
function onUrisChanged(uris) {
|
||||||
if (CurrentConversation.uris.length >= 8 && addMemberPanel.visible) {
|
if (uris && uris.length >= 8 && addMemberPanel.visible) {
|
||||||
swarmDetailsPanel.visible = false
|
swarmDetailsPanel.visible = false
|
||||||
addMemberPanel.visible = !addMemberPanel.visible
|
addMemberPanel.visible = !addMemberPanel.visible
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 by Savoir-faire Linux
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||||
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|
|
@ -32,6 +32,8 @@ RowLayout {
|
||||||
+ minimizeParticipant.visible
|
+ minimizeParticipant.visible
|
||||||
+ hangupParticipant.visible
|
+ hangupParticipant.visible
|
||||||
|
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
ParticipantOverlayButton {
|
ParticipantOverlayButton {
|
||||||
id: toggleModerator
|
id: toggleModerator
|
||||||
|
|
||||||
|
@ -39,6 +41,7 @@ RowLayout {
|
||||||
preferredSize: iconButtonPreferredSize
|
preferredSize: iconButtonPreferredSize
|
||||||
Layout.preferredHeight: buttonPreferredSize
|
Layout.preferredHeight: buttonPreferredSize
|
||||||
Layout.preferredWidth: buttonPreferredSize
|
Layout.preferredWidth: buttonPreferredSize
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
source: JamiResources.moderator_svg
|
source: JamiResources.moderator_svg
|
||||||
onClicked: CallAdapter.setModerator(uri, showSetModerator)
|
onClicked: CallAdapter.setModerator(uri, showSetModerator)
|
||||||
toolTipText: showSetModerator? JamiStrings.setModerator
|
toolTipText: showSetModerator? JamiStrings.setModerator
|
||||||
|
@ -52,6 +55,7 @@ RowLayout {
|
||||||
preferredSize: iconButtonPreferredSize
|
preferredSize: iconButtonPreferredSize
|
||||||
Layout.preferredHeight: buttonPreferredSize
|
Layout.preferredHeight: buttonPreferredSize
|
||||||
Layout.preferredWidth: buttonPreferredSize
|
Layout.preferredWidth: buttonPreferredSize
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
source: showModeratorMute ?
|
source: showModeratorMute ?
|
||||||
JamiResources.micro_black_24dp_svg :
|
JamiResources.micro_black_24dp_svg :
|
||||||
JamiResources.micro_off_black_24dp_svg
|
JamiResources.micro_off_black_24dp_svg
|
||||||
|
@ -83,6 +87,7 @@ RowLayout {
|
||||||
preferredSize: iconButtonPreferredSize
|
preferredSize: iconButtonPreferredSize
|
||||||
Layout.preferredHeight: buttonPreferredSize
|
Layout.preferredHeight: buttonPreferredSize
|
||||||
Layout.preferredWidth: buttonPreferredSize
|
Layout.preferredWidth: buttonPreferredSize
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
source: JamiResources.open_in_full_24dp_svg
|
source: JamiResources.open_in_full_24dp_svg
|
||||||
onClicked: CallAdapter.maximizeParticipant(uri)
|
onClicked: CallAdapter.maximizeParticipant(uri)
|
||||||
toolTipText: JamiStrings.maximizeParticipant
|
toolTipText: JamiStrings.maximizeParticipant
|
||||||
|
@ -95,6 +100,7 @@ RowLayout {
|
||||||
preferredSize: iconButtonPreferredSize
|
preferredSize: iconButtonPreferredSize
|
||||||
Layout.preferredHeight: buttonPreferredSize
|
Layout.preferredHeight: buttonPreferredSize
|
||||||
Layout.preferredWidth: buttonPreferredSize
|
Layout.preferredWidth: buttonPreferredSize
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
source: JamiResources.close_fullscreen_24dp_svg
|
source: JamiResources.close_fullscreen_24dp_svg
|
||||||
onClicked: CallAdapter.minimizeParticipant(uri)
|
onClicked: CallAdapter.minimizeParticipant(uri)
|
||||||
toolTipText: JamiStrings.minimizeParticipant
|
toolTipText: JamiStrings.minimizeParticipant
|
||||||
|
@ -107,6 +113,7 @@ RowLayout {
|
||||||
preferredSize: iconButtonPreferredSize
|
preferredSize: iconButtonPreferredSize
|
||||||
Layout.preferredHeight: buttonPreferredSize
|
Layout.preferredHeight: buttonPreferredSize
|
||||||
Layout.preferredWidth: buttonPreferredSize
|
Layout.preferredWidth: buttonPreferredSize
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
source: JamiResources.ic_hangup_participant_24dp_svg
|
source: JamiResources.ic_hangup_participant_24dp_svg
|
||||||
onClicked: CallAdapter.hangupParticipant(uri)
|
onClicked: CallAdapter.hangupParticipant(uri)
|
||||||
toolTipText: JamiStrings.hangupParticipant
|
toolTipText: JamiStrings.hangupParticipant
|
||||||
|
|
|
@ -93,7 +93,7 @@ Item {
|
||||||
id: mediaDistRender
|
id: mediaDistRender
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
rendererId: root.sinkId
|
rendererId: root.sinkId
|
||||||
crop: true
|
crop: !participantIsActive
|
||||||
|
|
||||||
underlayItems: Avatar {
|
underlayItems: Avatar {
|
||||||
property real componentSize: Math.min(mediaDistRender.contentRect.width / 2, mediaDistRender.contentRect.height / 2)
|
property real componentSize: Math.min(mediaDistRender.contentRect.width / 2, mediaDistRender.contentRect.height / 2)
|
||||||
|
|
|
@ -85,7 +85,7 @@ Item {
|
||||||
id: barComponent
|
id: barComponent
|
||||||
|
|
||||||
Control {
|
Control {
|
||||||
width: barButtons.implicitWidth
|
width: barButtons.implicitWidth + 16
|
||||||
height: shapeHeight
|
height: shapeHeight
|
||||||
hoverEnabled: false
|
hoverEnabled: false
|
||||||
|
|
||||||
|
@ -104,6 +104,9 @@ Item {
|
||||||
|
|
||||||
ParticipantControlLayout {
|
ParticipantControlLayout {
|
||||||
id: barButtons
|
id: barButtons
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: 8
|
||||||
|
anchors.rightMargin: 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 by Savoir-faire Linux
|
* Copyright (C) 2020-2022 Savoir-faire Linux Inc.
|
||||||
* Authors: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
* Authors: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||||
* Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
* Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
|
@ -141,9 +141,95 @@ Item {
|
||||||
radius: JamiTheme.primaryRadius
|
radius: JamiTheme.primaryRadius
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.margins: 4
|
||||||
|
|
||||||
|
// GENERIC
|
||||||
|
Flow {
|
||||||
|
id: commonParticipantsFlow
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
anchors.leftMargin: {
|
||||||
|
if (!inLine)
|
||||||
|
return 0
|
||||||
|
var showed = Math.min(genericParticipantsRect.showable, columns)
|
||||||
|
return Math.max(0, Math.ceil((parent.width - componentWidth * showed) / 2))
|
||||||
|
}
|
||||||
|
|
||||||
|
spacing: 4
|
||||||
|
property int columns: {
|
||||||
|
if (inLine)
|
||||||
|
return commonParticipants.count
|
||||||
|
var ratio = Math.floor(root.width / root.height)
|
||||||
|
// If ratio is 2 we can have 2 times more elements on each columns
|
||||||
|
var wantedCol = Math.max(1, Math.round(Math.sqrt(commonParticipants.count) * ratio))
|
||||||
|
var cols = Math.min(commonParticipants.count, wantedCol)
|
||||||
|
// Optimize with the rows (eg 7 with ratio 2 should have 4 and 3 items, not 6 and 1)
|
||||||
|
var rows = Math.max(1, Math.ceil(commonParticipants.count/cols))
|
||||||
|
return Math.min(Math.ceil(commonParticipants.count / rows), cols)
|
||||||
|
}
|
||||||
|
property int rows: Math.max(1, Math.ceil(commonParticipants.count/columns))
|
||||||
|
property int componentWidth: {
|
||||||
|
if (inLine)
|
||||||
|
return height
|
||||||
|
var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.columns
|
||||||
|
return Math.floor((commonParticipantsFlow.width - totalSpacing)/ commonParticipantsFlow.columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: commonParticipants
|
||||||
|
|
||||||
|
model: GenericParticipantsFilterModel
|
||||||
|
delegate: Loader {
|
||||||
|
sourceComponent: callVideoMedia
|
||||||
|
active: root.visible
|
||||||
|
asynchronous: true
|
||||||
|
visible: {
|
||||||
|
if (status !== Loader.Ready)
|
||||||
|
return false
|
||||||
|
if (inLine)
|
||||||
|
return index >= genericParticipantsRect.currentPos
|
||||||
|
&& index < genericParticipantsRect.currentPos + genericParticipantsRect.showable
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
width: commonParticipantsFlow.componentWidth + leftMargin_
|
||||||
|
height: {
|
||||||
|
if (inLine || commonParticipantsFlow.rows === 1)
|
||||||
|
return genericParticipantsRect.height
|
||||||
|
var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows
|
||||||
|
return Math.floor((genericParticipantsRect.height - totalSpacing)/ commonParticipantsFlow.rows)
|
||||||
|
}
|
||||||
|
|
||||||
|
property int leftMargin_: {
|
||||||
|
if (inLine || commonParticipantsFlow.rows === 1)
|
||||||
|
return 0
|
||||||
|
var lastParticipants = (commonParticipants.count % commonParticipantsFlow.columns)
|
||||||
|
if (lastParticipants !== 0 && index === commonParticipants.count - lastParticipants) {
|
||||||
|
var compW = commonParticipantsFlow.componentWidth + commonParticipantsFlow.spacing
|
||||||
|
var lastLineW = lastParticipants * compW
|
||||||
|
return Math.floor((commonParticipantsFlow.width - lastLineW) / 2)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
property string uri_: Uri
|
||||||
|
property string bestName_: BestName
|
||||||
|
property string avatar_: Avatar ? Avatar : ""
|
||||||
|
property string sinkId_: SinkId ? SinkId : ""
|
||||||
|
property bool isLocal_: IsLocal
|
||||||
|
property bool active_: Active
|
||||||
|
property bool videoMuted_: VideoMuted
|
||||||
|
property bool isContact_: IsContact
|
||||||
|
property bool isModerator_: IsModerator
|
||||||
|
property bool audioLocalMuted_: AudioLocalMuted
|
||||||
|
property bool audioModeratorMuted_: AudioModeratorMuted
|
||||||
|
property bool isHandRaised_: HandRaised
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RoundButton {
|
RoundButton {
|
||||||
|
@ -164,93 +250,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
z:0
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
// GENERIC
|
|
||||||
Flow {
|
|
||||||
id: commonParticipantsFlow
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: Math.ceil((parent.height - commonParticipants.height) / 2)
|
|
||||||
anchors.leftMargin: {
|
|
||||||
if (!inLine)
|
|
||||||
return 0
|
|
||||||
var showed = Math.min(genericParticipantsRect.showable, columns)
|
|
||||||
return Math.max(0, (parent.width - componentWidth * showed) / 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
spacing: 3
|
|
||||||
property int columns: {
|
|
||||||
if (inLine)
|
|
||||||
return commonParticipants.count
|
|
||||||
var ratio = Math.floor(root.width / root.height)
|
|
||||||
var sqrt = Math.max(1, Math.ceil(Math.sqrt(commonParticipants.count)))
|
|
||||||
var wantedCol = Math.max(1, Math.round(sqrt * ratio))
|
|
||||||
return Math.min(commonParticipants.count, wantedCol)
|
|
||||||
}
|
|
||||||
property int rows: Math.max(1, Math.ceil(commonParticipants.count/columns))
|
|
||||||
property int componentWidth: {
|
|
||||||
if (inLine)
|
|
||||||
return height
|
|
||||||
var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.columns
|
|
||||||
return Math.floor((genericParticipantsRect.width - totalSpacing)/ commonParticipantsFlow.columns)
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
id: commonParticipants
|
|
||||||
|
|
||||||
model: GenericParticipantsFilterModel
|
|
||||||
delegate: Loader {
|
|
||||||
sourceComponent: callVideoMedia
|
|
||||||
active: root.visible
|
|
||||||
asynchronous: true
|
|
||||||
visible: {
|
|
||||||
if (status !== Loader.Ready)
|
|
||||||
return false
|
|
||||||
if (inLine)
|
|
||||||
return index >= genericParticipantsRect.currentPos
|
|
||||||
&& index < genericParticipantsRect.currentPos + genericParticipantsRect.showable
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
width: commonParticipantsFlow.componentWidth + leftMargin_
|
|
||||||
height: {
|
|
||||||
if (inLine || commonParticipantsFlow.rows === 1)
|
|
||||||
return genericParticipantsRect.height
|
|
||||||
var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows
|
|
||||||
return Math.floor((genericParticipantsRect.height - totalSpacing)/ commonParticipantsFlow.rows)
|
|
||||||
}
|
|
||||||
|
|
||||||
property int leftMargin_: {
|
|
||||||
if (inLine || commonParticipantsFlow.rows === 1)
|
|
||||||
return 0
|
|
||||||
if (index === commonParticipants.count - commonParticipantsFlow.columns + 1) {
|
|
||||||
var compW = commonParticipantsFlow.componentWidth + commonParticipantsFlow.spacing
|
|
||||||
var lastLineW = (commonParticipants.count % commonParticipantsFlow.columns) * compW
|
|
||||||
return (genericParticipantsRect.width - lastLineW) / 2
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
property string uri_: Uri
|
|
||||||
property string bestName_: BestName
|
|
||||||
property string avatar_: Avatar ? Avatar : ""
|
|
||||||
property string sinkId_: SinkId ? SinkId : ""
|
|
||||||
property bool isLocal_: IsLocal
|
|
||||||
property bool active_: Active
|
|
||||||
property bool videoMuted_: VideoMuted
|
|
||||||
property bool isContact_: IsContact
|
|
||||||
property bool isModerator_: IsModerator
|
|
||||||
property bool audioLocalMuted_: AudioLocalMuted
|
|
||||||
property bool audioModeratorMuted_: AudioModeratorMuted
|
|
||||||
property bool isHandRaised_: HandRaised
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACTIVE
|
// ACTIVE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 by Savoir-faire Linux
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||||
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -67,7 +67,7 @@ Rectangle {
|
||||||
|
|
||||||
text: CurrentConversation.title
|
text: CurrentConversation.title
|
||||||
placeholderText: JamiStrings.editTitle
|
placeholderText: JamiStrings.editTitle
|
||||||
placeholderTextColor: UtilsAdapter.luma(backgroundColor) ? JamiTheme.placeholderTextColorWhite : JamiTheme.placeholderTextColor
|
placeholderTextColor: UtilsAdapter.luma(root.color) ? JamiTheme.placeholderTextColorWhite : JamiTheme.placeholderTextColor
|
||||||
tooltipText: JamiStrings.editTitle
|
tooltipText: JamiStrings.editTitle
|
||||||
backgroundColor: root.color
|
backgroundColor: root.color
|
||||||
color: UtilsAdapter.luma(backgroundColor) ?
|
color: UtilsAdapter.luma(backgroundColor) ?
|
||||||
|
@ -93,7 +93,7 @@ Rectangle {
|
||||||
|
|
||||||
text: CurrentConversation.description
|
text: CurrentConversation.description
|
||||||
placeholderText: JamiStrings.editDescription
|
placeholderText: JamiStrings.editDescription
|
||||||
placeholderTextColor: UtilsAdapter.luma(backgroundColor) ? JamiTheme.placeholderTextColorWhite : JamiTheme.placeholderTextColor
|
placeholderTextColor: UtilsAdapter.luma(root.color) ? JamiTheme.placeholderTextColorWhite : JamiTheme.placeholderTextColor
|
||||||
tooltipText: JamiStrings.editDescription
|
tooltipText: JamiStrings.editDescription
|
||||||
backgroundColor: root.color
|
backgroundColor: root.color
|
||||||
color: UtilsAdapter.luma(backgroundColor) ?
|
color: UtilsAdapter.luma(backgroundColor) ?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 by Savoir-faire Linux
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||||
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|
|
@ -435,6 +435,8 @@ Utils::tempConversationAvatar(const QSize& size)
|
||||||
QImage
|
QImage
|
||||||
Utils::imageFromBase64String(const QString& str, bool circleCrop)
|
Utils::imageFromBase64String(const QString& str, bool circleCrop)
|
||||||
{
|
{
|
||||||
|
if (str.isEmpty())
|
||||||
|
return {};
|
||||||
return imageFromBase64Data(Utils::base64StringToByteArray(str), circleCrop);
|
return imageFromBase64Data(Utils::base64StringToByteArray(str), circleCrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -511,10 +511,12 @@ void
|
||||||
UtilsAdapter::setSwarmCreationImageFromImage(const QImage& image, const QString& imageId)
|
UtilsAdapter::setSwarmCreationImageFromImage(const QImage& image, const QString& imageId)
|
||||||
{
|
{
|
||||||
// Compress the image before saving
|
// Compress the image before saving
|
||||||
auto img = Utils::scaleAndFrame(image, QSize(256, 256));
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
QBuffer bu(&ba);
|
QBuffer bu(&ba);
|
||||||
img.save(&bu, "PNG");
|
if (!image.isNull()) {
|
||||||
|
auto img = Utils::scaleAndFrame(image, QSize(256, 256));
|
||||||
|
img.save(&bu, "PNG");
|
||||||
|
}
|
||||||
// Save the image
|
// Save the image
|
||||||
if (imageId == "temp") {
|
if (imageId == "temp") {
|
||||||
QFile file(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)
|
QFile file(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)
|
||||||
|
|
|
@ -32,13 +32,12 @@ Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// trigger a default avatar prior to account generation
|
// trigger a default avatar prior to account generation
|
||||||
property string createdAccountId: "dummy"
|
property string createdAccountId
|
||||||
property int preferredHeight: profilePageColumnLayout.implicitHeight
|
property int preferredHeight: profilePageColumnLayout.implicitHeight
|
||||||
|
|
||||||
signal showThisPage
|
signal showThisPage
|
||||||
|
|
||||||
function initializeOnShowUp() {
|
function initializeOnShowUp() {
|
||||||
createdAccountId = "dummy"
|
|
||||||
clearAllTextFields()
|
clearAllTextFields()
|
||||||
saveProfileBtn.spinnerTriggered = true
|
saveProfileBtn.spinnerTriggered = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue