Commit 6fc9d817 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Much better appearance for fixed panels, and use flat buttons

Also display private chat actions (typing, uploading, etc)
parent e0e39431
......@@ -43,5 +43,6 @@
<file>qml/components/DialogCountrySelector.qml</file>
<file>qml/components/DelegateFormattedText.qml</file>
<file>qml/components/DelegateAbstractMessageContent.qml</file>
<file>qml/components/PanelFixed.qml</file>
</qresource>
</RCC>
......@@ -16,7 +16,7 @@ QtObject {
property bool showInputPanel : false;
readonly property color panelColor : Qt.rgba (1.0 - Theme.primaryColor.r, 1.0 - Theme.primaryColor.g, 1.0 - Theme.primaryColor.b, 0.85);
readonly property color panelColor : Qt.rgba (1.0 - Theme.primaryColor.r, 1.0 - Theme.primaryColor.g, 1.0 - Theme.primaryColor.b);
property alias groupImagesInAlbums : configGroupImagesInAlbum.value;
property alias groupVideosInAlbums : configGroupVideosInAlbum.value;
......
import QtQuick 2.6;
import QtQmlTricks 3.0;
import Sailfish.Silica 1.0;
import harbour.Telegrame 1.0;
MouseArea {
id: self;
onPressed: { }
onReleased: { }
Rectangle {
color: Theme.highlightBackgroundColor;
opacity: 0.15;
anchors.fill: parent;
}
Rectangle {
color: Theme.primaryColor;
opacity: 0.35;
anchors.fill: parent;
}
Rectangle {
color: Helpers.panelColor;
opacity: 0.85;
anchors.fill: parent;
}
}
......@@ -5,18 +5,20 @@ import harbour.Telegrame 1.0;
MouseArea {
id: btn;
opacity: (enabled ? 1.0 : 0.35);
opacity: (enabled ? 1.0 : 0.15);
implicitWidth: Theme.itemSizeSmall;
implicitHeight: Theme.itemSizeSmall;
property int size : Theme.iconSizeMedium;
property bool active : false;
property bool rounded : true;
property bool flat : false;
property string icon : "";
Rectangle {
color: Theme.rgba ((active || pressed ? Theme.highlightColor : Theme.primaryColor), (active ? 0.35 : 0.15));
radius: (rounded ? Theme.paddingSmall : 0);
visible: (!flat || active);
antialiasing: rounded;
anchors.fill: parent;
}
......
......@@ -109,20 +109,15 @@ ApplicationWindow {
implicitHeight: (rotation % 180 !== 0 ? parent.width : parent.height);
anchors.centerIn: parent;
MouseArea {
PanelFixed {
id: footerChat;
visible: enabled;
enabled: Helpers.showInputPanel;
opacity: (enabled ? 1.0 : 0.0);
implicitHeight: (layoutFooter.height + layoutFooter.anchors.margins * 2);
ExtraAnchors.bottomDock: parent;
onPressed: { }
onReleased: { }
Rectangle {
color: Helpers.panelColor;
anchors.fill: parent;
}
ColumnContainer {
id: layoutFooter;
spacing: 1;
......@@ -141,7 +136,18 @@ ApplicationWindow {
ExtraAnchors.horizontalFill: parent;
Container.forcedHeight: Math.ceil (implicitHeight + anchors.margins * 2);
LabelFixed {
text: (TD_Global.selectedPhotosCount > 0
? (TD_Global.selectedPhotosCount > 1
? qsTr ("Send %1 images (as an album)").arg (TD_Global.selectedPhotosCount)
: qsTr ("Send 1 image"))
: qsTr ("No image selected"));
color: (TD_Global.selectedPhotosCount > 0 ? Theme.highlightColor : Theme.secondaryColor);
anchors.verticalCenter: parent.verticalCenter;
Container.horizontalStretch: 1;
}
RectangleButton {
flat: true;
icon: "icon-m-clear";
size: (Theme.iconSizeMedium * 0.65);
enabled: (TD_Global.selectedPhotosCount > 0);
......@@ -152,16 +158,6 @@ ApplicationWindow {
TD_Global.unselectAllPhotos ();
}
}
LabelFixed {
text: (TD_Global.selectedPhotosCount > 0
? (TD_Global.selectedPhotosCount > 1
? qsTr ("Send %1 images (as an album)").arg (TD_Global.selectedPhotosCount)
: qsTr ("Send 1 image"))
: qsTr ("No image selected"));
color: (TD_Global.selectedPhotosCount > 0 ? Theme.highlightColor : Theme.secondaryColor);
anchors.verticalCenter: parent.verticalCenter;
Container.horizontalStretch: 1;
}
}
SilicaListView {
orientation: ListView.Horizontal;
......@@ -226,8 +222,19 @@ ApplicationWindow {
ExtraAnchors.horizontalFill: parent;
Container.forcedHeight: Math.ceil (implicitHeight + anchors.margins * 2);
LabelFixed {
text: (TD_Global.selectedVideosCount > 0
? (TD_Global.selectedVideosCount > 1
? qsTr ("Send %1 videos (as an album)").arg (TD_Global.selectedVideosCount)
: qsTr ("Send 1 video"))
: qsTr ("No video selected"));
color: (TD_Global.selectedVideosCount > 0 ? Theme.highlightColor : Theme.secondaryColor);
anchors.verticalCenter: parent.verticalCenter;
Container.horizontalStretch: 1;
}
RectangleButton {
icon: "icon-m-clear";
flat: true;
size: (Theme.iconSizeMedium * 0.65);
enabled: (TD_Global.selectedVideosCount > 0);
implicitWidth: Theme.itemSizeExtraSmall;
......@@ -237,16 +244,6 @@ ApplicationWindow {
TD_Global.unselectAllVideos ();
}
}
LabelFixed {
text: (TD_Global.selectedVideosCount > 0
? (TD_Global.selectedVideosCount > 1
? qsTr ("Send %1 videos (as an album)").arg (TD_Global.selectedVideosCount)
: qsTr ("Send 1 video"))
: qsTr ("No video selected"));
color: (TD_Global.selectedVideosCount > 0 ? Theme.highlightColor : Theme.secondaryColor);
anchors.verticalCenter: parent.verticalCenter;
Container.horizontalStretch: 1;
}
}
SilicaListView {
orientation: ListView.Horizontal;
......@@ -478,6 +475,7 @@ ApplicationWindow {
RectangleButton {
icon: "icon-m-back";
flat: true;
size: (Theme.iconSizeMedium * 0.65);
enabled: (modelDocuments.folder.toString () !== modelDocuments.limitedTo);
implicitWidth: Theme.itemSizeExtraSmall;
......@@ -596,14 +594,15 @@ ApplicationWindow {
Container.ignored: true;
RowContainer {
spacing: Theme.paddingSmall;
spacing: Theme.paddingMedium;
anchors.centerIn: parent;
RectangleButton {
id: btnRecord;
flat: true;
icon: "icon-m-call-recording-on";
size: Theme.iconSizeMedium;
enabled: !btnReplay.active;
size: (Theme.iconSizeMedium * 0.65);
implicitWidth: Theme.itemSizeExtraSmall;
implicitHeight: Theme.itemSizeExtraSmall;
anchors.verticalCenter: parent.verticalCenter;
......@@ -625,9 +624,10 @@ ApplicationWindow {
RectangleButton {
id: btnReplay;
icon: "icon-m-play";
flat: true;
size: Theme.iconSizeMedium;
active: (playerRecording.playbackState === MediaPlayer.PlayingState);
enabled: (currentRecording !== "");
size: (Theme.iconSizeMedium * 0.65);
implicitWidth: Theme.itemSizeExtraSmall;
implicitHeight: Theme.itemSizeExtraSmall;
anchors.verticalCenter: parent.verticalCenter;
......@@ -656,9 +656,10 @@ ApplicationWindow {
}
RectangleButton {
id: btnReset;
flat: true;
icon: "icon-m-delete";
size: Theme.iconSizeMedium;
enabled: (currentRecording !== "" && !btnRecord.active && !btnReplay.active);
size: (Theme.iconSizeMedium * 0.65);
implicitWidth: Theme.itemSizeExtraSmall;
implicitHeight: Theme.itemSizeExtraSmall;
anchors.verticalCenter: parent.verticalCenter;
......@@ -696,6 +697,8 @@ ApplicationWindow {
ExtraAnchors.horizontalFill: parent;
RectangleButton {
id: btnSelect;
flat: true;
active: selectorMsgType.visible;
rounded: false;
enabled: (TD_Global.editingMessageId === "");
......@@ -711,6 +714,7 @@ ApplicationWindow {
case TD_ObjectType.MESSAGE_VIDEO_NOTE: return "icon-m-play";
case TD_ObjectType.MESSAGE_DOCUMENT: return "icon-m-attach";
}
return "";
}
anchors.bottom: parent.bottom;
onClicked: {
......@@ -781,8 +785,9 @@ ApplicationWindow {
}
RectangleButton {
id: btnSendMsg;
flat: true;
icon: "icon-m-enter";
size: (Theme.iconSizeMedium * 0.65);
size: (Theme.iconSizeMedium * 0.85);
enabled: {
switch (Helpers.currentMsgType) {
case TD_ObjectType.MESSAGE_TEXT: return (textBox.text.trim () !== "");
......@@ -796,7 +801,7 @@ ApplicationWindow {
}
implicitWidth: Theme.itemSizeExtraSmall;
implicitHeight: Theme.itemSizeExtraSmall;
anchors.bottom: parent.bottom;
anchors.verticalCenter: btnSelect.verticalCenter;
onClicked: {
execute ();
}
......
This diff is collapsed.
......@@ -63,9 +63,8 @@ Page {
VerticalScrollDecorator {
flickable: flickerContacts;
}
Rectangle {
PanelFixed {
id: headerContacts;
color: Helpers.panelColor;
implicitHeight: (title.height + title.anchors.margins * 2);
ExtraAnchors.topDock: parent;
......
......@@ -529,8 +529,7 @@ Page {
onReleased: { }
Behavior on opacity { NumberAnimation { duration: 150; } }
Rectangle {
color: Helpers.panelColor;
PanelFixed {
anchors.fill: parent;
Rectangle {
......
......@@ -142,9 +142,8 @@ Page {
VerticalScrollDecorator {
flickable: flickerSettings;
}
Rectangle {
PanelFixed {
id: headerSettings;
color: Helpers.panelColor;
implicitHeight: (titleSettings.height + titleSettings.anchors.margins * 2);
ExtraAnchors.topDock: parent;
......
......@@ -152,9 +152,8 @@ Page {
}
}
}
Rectangle {
PanelFixed {
id: headerUserInfo;
color: Helpers.panelColor;
implicitHeight: (title.height + title.anchors.margins * 2);
ExtraAnchors.topDock: parent;
......
Name: harbour-telegrame
Summary: A native Telegram client for Sailfish OS
Version: 0.10
Release: 19
Release: 20
Group: Qt/Qt
URL: http://gitlab.unique-conception.org/sailfish-app/telegra-me
......
......@@ -6,7 +6,6 @@ QtTdLibChat::QtTdLibChat (const qint64 id, QObject * parent)
: QtTdLibAbstractInt53IdObject { QtTdLibObjectType::CHAT, id, parent }
, m_isCurrentChat { false }
, m_firstUnreadMessageItem { Q_NULLPTR }
, m_chatActions { new QQmlObjectListModel<QtTdLibChatAction> { this, { }, "userId" } }
{
QtTdLibCollection::allChats.insert (id, this);
static const QString ICON { "/usr/share/icons/hicolor/128x128/apps/harbour-telegrame.png" };
......
......@@ -173,7 +173,8 @@ public:
class QtTdLibChatTypePrivate : public QtTdLibChatType, public FactoryNoId<QtTdLibChatTypePrivate> {
Q_OBJECT
Q_TDLIB_PROPERTY_ID32 (userId)
Q_TDLIB_PROPERTY_ID32 (userId)
Q_TDLIB_PROPERTY_SUBOBJECT (currentChatAction, QtTdLibChatAction)
public:
explicit QtTdLibChatTypePrivate (QObject * parent = Q_NULLPTR);
......@@ -263,8 +264,6 @@ class QtTdLibChat : public QtTdLibAbstractInt53IdObject, public FactoryInt53Id<Q
QML_READONLY_PTR_PROPERTY (firstUnreadMessageItem, QtTdLibMessage)
QML_OBJMODEL_PROPERTY (chatActions, QtTdLibChatAction)
public:
explicit QtTdLibChat (const qint64 id = 0, QObject * parent = Q_NULLPTR);
virtual ~QtTdLibChat (void);
......
......@@ -1357,20 +1357,12 @@ void QtTdLibGlobal::onFrame (const QJsonObject & json) {
case QtTdLibObjectType::UPDATE_USER_CHAT_ACTION: {
const qint64 chatId { QtTdLibId53Helper::fromJsonToCpp (json ["chat_id"]) };
if (QtTdLibChat * chatItem = { getChatItemById (chatId) }) {
const qint32 userId { QtTdLibId32Helper::fromJsonToCpp (json ["user_id"]) };
const QJsonObject chatActionJson { json ["action"].toObject () };
const QtTdLibObjectType::Type typeOfChatAction { QtTdLibEnums::objectTypeEnumFromJson (chatActionJson) };
if (QtTdLibChatAction * chatActionItem = { chatItem->get_chatActions ()->getByUid (QString::number (userId)) }) {
chatItem->get_chatActions ()->remove (chatActionItem);
}
if (typeOfChatAction != QtTdLibObjectType::INVALID &&
typeOfChatAction != QtTdLibObjectType::CHAT_ACTION_CANCEL) {
if (QtTdLibChatAction * chatAction = { QtTdLibChatAction::createAbstract (chatActionJson) }) {
chatAction->set_userId (userId);
chatItem->get_chatActions ()->append (chatAction);
}
if (QtTdLibChatTypePrivate * privateChatItem = qobject_cast<QtTdLibChatTypePrivate *> (chatItem->get_type ())) {
privateChatItem->set_currentChatAction_withJSON (json ["action"], &QtTdLibChatAction::createAbstract);
}
else { }
}
else { }
break;
}
case QtTdLibObjectType::STICKER_SETS: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment