1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-22 06:02:03 +02:00

file transfer: update design

Change-Id: I05cc9eaa645220f2576b69eaa63853fd24fa7c4d
This commit is contained in:
Fadi SHEHADEH 2022-12-30 15:41:35 -05:00 committed by Sébastien Blin
parent 297ad48494
commit 6862804a44
6 changed files with 161 additions and 93 deletions

View file

@ -405,7 +405,6 @@ Item {
property real chatViewFooterButtonSize: 36 property real chatViewFooterButtonSize: 36
property real chatViewFooterButtonIconSize: 48 property real chatViewFooterButtonIconSize: 48
property real chatViewFooterButtonRadius: 5 property real chatViewFooterButtonRadius: 5
property real chatViewFooterFileContainerPreferredHeight: 150
property real chatViewFooterTextAreaMaximumHeight: 130 property real chatViewFooterTextAreaMaximumHeight: 130
property real chatViewScrollToBottomButtonBottomMargin: 8 property real chatViewScrollToBottomButtonBottomMargin: 8
@ -419,13 +418,14 @@ Item {
property real typingDotsSize: 8 property real typingDotsSize: 8
// MessageWebView File Transfer Container // MessageWebView File Transfer Container
property real filesToSendContainerSpacing: 5 property real filesToSendContainerSpacing: 120
property real filesToSendContainerPadding: 10 property real filesToSendContainerPadding: 10
property real filesToSendDelegateWidth: 100 property real filesToSendDelegateWidth: 100
property real filesToSendDelegateHeight: 100 property real filesToSendDelegateHeight: 100
property real filesToSendDelegateRadius: 7 property real filesToSendDelegateRadius: 7
property real filesToSendDelegateButtonSize: 16 property real filesToSendDelegateButtonSize: 16
property real filesToSendDelegateFontPointSize: calcSize(textFontSize + 2) property real filesToSendDelegateFontPointSize: calcSize(textFontSize + 2)
property real layoutWidthFileTransfer: 80
// SBSMessageBase // SBSMessageBase
property int sbsMessageBasePreferredPadding: 12 property int sbsMessageBasePreferredPadding: 12

View file

@ -64,7 +64,11 @@ FilesToSendListModel::addToPending(QString filePath)
isImage = true; isImage = true;
beginInsertRows(QModelIndex(), pendingFiles_.size(), pendingFiles_.size()); beginInsertRows(QModelIndex(), pendingFiles_.size(), pendingFiles_.size());
auto item = FilesToSend::Item(filePath, fileInfo.fileName(), isImage, fileInfo.size()); auto item = FilesToSend::Item(filePath,
fileInfo.baseName(),
fileInfo.suffix(),
isImage,
fileInfo.size());
pendingFiles_.append(item); pendingFiles_.append(item);
endInsertRows(); endInsertRows();
} }
@ -97,6 +101,8 @@ FilesToSendListModel::data(const QModelIndex& index, int role) const
return QVariant(item.fileName); return QVariant(item.fileName);
case Role::FilePath: case Role::FilePath:
return QVariant(item.filePath); return QVariant(item.filePath);
case Role::FileExtension:
return QVariant(item.fileExtension);
case Role::FileSize: case Role::FileSize:
return QVariant(Utils::humanFileSize(item.fileSizeInByte)); return QVariant(Utils::humanFileSize(item.fileSizeInByte));
case Role::IsImage: case Role::IsImage:

View file

@ -25,6 +25,7 @@
X(FileName) \ X(FileName) \
X(FilePath) \ X(FilePath) \
X(FileSize) \ X(FileSize) \
X(FileExtension) \
X(IsImage) X(IsImage)
namespace FilesToSend { namespace FilesToSend {
@ -39,15 +40,21 @@ Q_ENUM_NS(Role)
struct Item struct Item
{ {
Item(QString filePath, QString fileName, bool isImage, qint64 fileSizeInByte) Item(QString filePath,
QString fileName,
QString fileExtension,
bool isImage,
qint64 fileSizeInByte)
: filePath(filePath) : filePath(filePath)
, fileName(fileName) , fileName(fileName)
, fileExtension(fileExtension)
, isImage(isImage) , isImage(isImage)
, fileSizeInByte(fileSizeInByte) , fileSizeInByte(fileSizeInByte)
{} {}
QString filePath; QString filePath;
QString fileName; QString fileName;
QString fileExtension;
bool isImage; bool isImage;
qint64 fileSizeInByte; qint64 fileSizeInByte;
}; };

View file

@ -260,7 +260,7 @@ Rectangle {
Layout.preferredWidth: footerColumnLayout.width Layout.preferredWidth: footerColumnLayout.width
Layout.maximumWidth: JamiTheme.chatViewMaximumWidth Layout.maximumWidth: JamiTheme.chatViewMaximumWidth
Layout.preferredHeight: filesToSendCount ? Layout.preferredHeight: filesToSendCount ?
JamiTheme.chatViewFooterFileContainerPreferredHeight : 0 JamiTheme.filesToSendDelegateHeight : 0
} }
} }
} }

View file

@ -30,8 +30,6 @@ Rectangle {
property alias filesToSendListModel: repeater.model property alias filesToSendListModel: repeater.model
property alias filesToSendCount: repeater.count property alias filesToSendCount: repeater.count
color: JamiTheme.messageOutBgColor
JamiFlickable { JamiFlickable {
id: filesToSendContainerScrollView id: filesToSendContainerScrollView

View file

@ -23,77 +23,75 @@ import Qt5Compat.GraphicalEffects
import net.jami.Adapters 1.1 import net.jami.Adapters 1.1
import net.jami.Constants 1.1 import net.jami.Constants 1.1
import net.jami.Models 1.1 import net.jami.Models 1.1
import "../../commoncomponents" import "../../commoncomponents"
Rectangle { Item {
id: root id: root
property real margin: 5 property real margin: 5
signal removeFileButtonClicked(int index) signal removeFileButtonClicked(int index)
RowLayout {
anchors.fill: root
spacing : 2
Rectangle {
id: mainRect
radius: JamiTheme.filesToSendDelegateRadius radius: JamiTheme.filesToSendDelegateRadius
Layout.preferredHeight: root.height - 4 * margin
Layout.preferredWidth: JamiTheme.layoutWidthFileTransfer
color: JamiTheme.transparentColor
color: CurrentConversation.color Rectangle {
id: rect
ColumnLayout {
id: delegateFileWrapperColumnLayout
anchors.fill: parent anchors.fill: parent
color: CurrentConversation.color // "#E5E5E5"
layer.enabled: true
spacing: 0 layer.effect: OpacityMask {
maskSource: Item {
width: rect.width
height: rect.height
Rectangle {
anchors.centerIn: parent
width: rect.width
height: rect.height
radius: JamiTheme.chatViewFooterButtonRadius
}
}
}
visible: !IsImage Rectangle {
width: parent.width
anchors.bottom: parent.bottom
height: 3/4 * mainRect.height
color: CurrentConversation.color
}
Rectangle {
anchors.fill: parent
anchors.margins: margin
radius: JamiTheme.chatViewFooterButtonRadius
color: JamiTheme.whiteColor
ResponsiveImage { ResponsiveImage {
id: fileIcon id: fileIcon
visible : !IsImage
Layout.alignment: Qt.AlignTop | Qt.AlignLeft anchors.fill: parent
Layout.topMargin: margin anchors.margins: margin
Layout.leftMargin: margin
visible: !IsImage
source: JamiResources.file_black_24dp_svg source: JamiResources.file_black_24dp_svg
} }
Text {
id: fileName
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.leftMargin: margin
Layout.preferredWidth: root.width - margin * 2
visible: !IsImage
font.pointSize: JamiTheme.filesToSendDelegateFontPointSize
text: FileName
elide: Text.ElideMiddle
}
Text {
id: fileSize
Layout.alignment: Qt.AlignBottom
Layout.leftMargin: margin
Layout.bottomMargin: margin
Layout.preferredWidth: root.width - margin * 2
visible: !IsImage
font.pointSize: JamiTheme.filesToSendDelegateFontPointSize
text: FileSize
elide: Text.ElideMiddle
}
}
AnimatedImage { AnimatedImage {
id: name id: name
anchors.fill: parent anchors.fill: parent
anchors.margins: margin
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
@ -112,32 +110,91 @@ Rectangle {
layer.enabled: true layer.enabled: true
layer.effect: OpacityMask { layer.effect: OpacityMask {
maskSource: Rectangle { maskSource: Rectangle {
width: root.width width: mainRect.width
height: root.height height: mainRect.height
radius: JamiTheme.filesToSendDelegateRadius radius: JamiTheme.filesToSendDelegateRadius
} }
} }
} }
}
}
PushButton { PushButton {
id: removeFileButton id: removeFileButton
anchors.right: root.right anchors.right: mainRect.right
anchors.rightMargin: -margin anchors.rightMargin: -margin
anchors.top: root.top anchors.top: mainRect.top
anchors.topMargin: -margin anchors.topMargin: -margin
radius: margin radius: 24
preferredSize: JamiTheme.filesToSendDelegateButtonSize
preferredSize: 30
imageContainerWidth: 52
imageContainerHeight: 52
toolTipText: JamiStrings.optionRemove toolTipText: JamiStrings.optionRemove
source: JamiResources.cross_black_24dp_svg source: JamiResources.cross_black_24dp_svg
normalColor: JamiTheme.removeFileButtonColor normalColor: JamiTheme.backgroundColor
hoveredColor: JamiTheme.lightGrey_
imageColor: JamiTheme.textColor imageColor: JamiTheme.textColor
onClicked: root.removeFileButtonClicked(index) onClicked: root.removeFileButtonClicked(index)
} }
}
Rectangle {
id: info
Layout.preferredHeight: root.height -margin
Layout.preferredWidth: JamiTheme.layoutWidthFileTransfer
color : JamiTheme.transparentColor
Layout.alignment: Qt.AlignLeft
ColumnLayout {
anchors.margins: margin
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
Text {
id: fileName
Layout.alignment: Qt.AlignLeft
Layout.preferredWidth: info.width
font.pointSize: JamiTheme.filesToSendDelegateFontPointSize
color: JamiTheme.chatviewTextColor
font.bold : true
text: FileName
elide: Text.ElideRight
}
RowLayout {
Layout.alignment: Qt.AlignLeft
spacing: FileExtension.length === 0 ? 0 : 1
Text {
id: fileExtension
Layout.alignment: Qt.AlignLeft
font.pointSize: JamiTheme.filesToSendDelegateFontPointSize
font.capitalization: Font.AllUppercase
color: JamiTheme.chatviewTextColor
text: FileExtension
elide: Text.ElideMiddle
}
Text {
id: fileSize
font.pointSize: JamiTheme.filesToSendDelegateFontPointSize
color: JamiTheme.chatviewTextColor
Layout.alignment: Qt.AlignLeft
text: FileSize
elide: Text.ElideMiddle
}
}
}
}
}
} }