Commit e7311e4a authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Start supporting landscape mode

parent 31a77493
This diff is collapsed.
......@@ -503,6 +503,8 @@ Page {
opacity: (pulleyTop.active ? 0.0 : 1.0);
implicitHeight: (layoutHeader.height + layoutHeader.anchors.margins * 2);
ExtraAnchors.topDock: parent;
onPressed: { }
onReleased: { }
Behavior on opacity { NumberAnimation { duration: 150; } }
Rectangle {
......
......@@ -382,10 +382,9 @@ Page {
implicitHeight: (Theme.iconSizeMedium + Theme.paddingMedium * 2);
menu: ContextMenu {
MenuItem {
text: (delegateChat.chatItem.isPinned ? qsTr ("Un-pin from favorites [TODO]") : qsTr ("Pin to favorites [TODO]"));
enabled: false;
text: (delegateChat.chatItem.isPinned ? qsTr ("Un-pin from favorites") : qsTr ("Pin to favorites"));
onClicked: {
// TODO
TD_Global.togglePinChat (delegateChat.chatItem);
}
}
MenuItem {
......@@ -579,7 +578,9 @@ Page {
}
MouseArea {
id: headerConversations;
implicitHeight: (layoutHeader.height + layoutHeader.anchors.margins * 2);
implicitHeight: (window.isPortrait
? (layoutTitle.height + layoutSearch.height + Theme.paddingMedium * 3)
: (Math.max (layoutTitle.height, layoutSearch.height) + Theme.paddingMedium * 2));
ExtraAnchors.topDock: parent;
onPressed: { }
onReleased: { }
......@@ -588,85 +589,82 @@ Page {
color: Qt.rgba (1.0 - Theme.primaryColor.r, 1.0 - Theme.primaryColor.g, 1.0 - Theme.primaryColor.b, 0.85);
anchors.fill: parent;
}
ColumnContainer {
id: layoutHeader;
spacing: Theme.paddingSmall;
anchors.margins: Theme.paddingMedium;
ExtraAnchors.topDock: parent;
RowContainer {
spacing: Theme.paddingMedium;
anchors.leftMargin: Theme.paddingMedium;
anchors.rightMargin: Theme.paddingLarge;
ExtraAnchors.horizontalFill: parent;
RowContainer {
id: layoutTitle;
spacing: Theme.paddingMedium;
anchors.topMargin: Theme.paddingMedium;
anchors.rightMargin: Theme.paddingLarge;
ExtraAnchors.topRightCorner: parent;
Item {
Container.horizontalStretch: 1;
}
Item {
implicitWidth: Theme.iconSizeMedium;
implicitHeight: Theme.iconSizeMedium;
anchors.verticalCenter: parent.verticalCenter;
Item {
implicitWidth: Theme.iconSizeMedium;
implicitHeight: Theme.iconSizeMedium;
anchors.verticalCenter: parent.verticalCenter;
GlassItem {
color: {
switch (TD_Global.connectionState ? TD_Global.connectionState.typeOf : -1) {
case TD_ObjectType.CONNECTION_STATE_WAITING_FOR_NETWORK: return "red";
case TD_ObjectType.CONNECTION_STATE_CONNECTING: return "orange";
case TD_ObjectType.CONNECTION_STATE_CONNECTING_TO_PROXY: return "orange";
case TD_ObjectType.CONNECTION_STATE_UPDATING: return "orange";
case TD_ObjectType.CONNECTION_STATE_READY: return "lime";
}
return "magenta";
GlassItem {
color: {
switch (TD_Global.connectionState ? TD_Global.connectionState.typeOf : -1) {
case TD_ObjectType.CONNECTION_STATE_WAITING_FOR_NETWORK: return "red";
case TD_ObjectType.CONNECTION_STATE_CONNECTING: return "orange";
case TD_ObjectType.CONNECTION_STATE_CONNECTING_TO_PROXY: return "orange";
case TD_ObjectType.CONNECTION_STATE_UPDATING: return "orange";
case TD_ObjectType.CONNECTION_STATE_READY: return "lime";
}
anchors.centerIn: parent;
return "magenta";
}
anchors.centerIn: parent;
}
LabelFixed {
text: qsTr ("Conversations");
color: Theme.highlightColor;
horizontalAlignment: Text.AlignRight;
font {
family: Theme.fontFamilyHeading;
pixelSize: Theme.fontSizeLarge;
}
anchors.verticalCenter: parent.verticalCenter;
}
LabelFixed {
text: qsTr ("Conversations");
color: Theme.highlightColor;
horizontalAlignment: Text.AlignRight;
font {
family: Theme.fontFamilyHeading;
pixelSize: Theme.fontSizeLarge;
}
anchors.verticalCenter: parent.verticalCenter;
}
}
RowContainer {
id: layoutSearch;
spacing: Theme.paddingSmall;
anchors {
top: (window.isPortrait ? layoutTitle.bottom : parent.top);
left: parent.left;
right: (window.isPortrait ? parent.right : layoutTitle.left);
topMargin: Theme.paddingMedium;
leftMargin: Theme.paddingLarge;
rightMargin: Theme.paddingLarge;
}
RowContainer {
spacing: Theme.paddingSmall;
anchors.leftMargin: Theme.paddingLarge;
anchors.rightMargin: Theme.paddingLarge;
ExtraAnchors.horizontalFill: parent;
Image {
source: "image://theme/icon-m-search";
sourceSize: Qt.size (Theme.iconSizeMedium, Theme.iconSizeMedium);
anchors.verticalCenter: parent.verticalCenter;
}
TextField {
id: inputFilter;
labelVisible: false;
placeholderText: qsTr ("Filter...");
anchors.verticalCenter: parent.verticalCenter;
Container.horizontalStretch: 1;
Image {
source: "image://theme/icon-m-search";
sourceSize: Qt.size (Theme.iconSizeMedium, Theme.iconSizeMedium);
anchors.verticalCenter: parent.verticalCenter;
}
TextField {
id: inputFilter;
labelVisible: false;
placeholderText: qsTr ("Filter...");
anchors.verticalCenter: parent.verticalCenter;
Container.horizontalStretch: 1;
readonly property string value : text.trim ().toLowerCase ();
readonly property string value : text.trim ().toLowerCase ();
}
IconButton {
id: clearButton;
opacity: (inputFilter.text.length > 0 ? 1.0 : 0.0);
implicitWidth: Theme.itemSizeSmall;
implicitHeight: Theme.itemSizeSmall;
icon.source: "image://theme/icon-m-clear";
icon.sourceSize: Qt.size (Theme.iconSizeMedium, Theme.iconSizeMedium);
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
inputFilter.text = "";
}
IconButton {
id: clearButton;
opacity: (inputFilter.text.length > 0 ? 1.0 : 0.0);
implicitWidth: Theme.itemSizeSmall;
implicitHeight: Theme.itemSizeSmall;
icon.source: "image://theme/icon-m-clear";
icon.sourceSize: Qt.size (Theme.iconSizeMedium, Theme.iconSizeMedium);
anchors.verticalCenter: parent.verticalCenter;
onClicked: {
inputFilter.text = "";
}
Behavior on opacity { FadeAnimation { } }
}
Behavior on opacity { FadeAnimation { } }
}
}
}
......
Name: harbour-telegrame
Summary: A native Telegram client for Sailfish OS
Version: 0.9
Release: 2
Release: 4
Group: Qt/Qt
URL: http://example.org/
......
......@@ -357,6 +357,24 @@ void QtTdLibGlobal::markAllMessagesAsRead (QtTdLibChat * chatItem) {
}
}
void QtTdLibGlobal::togglePinChat (QtTdLibChat * chatItem) {
if (chatItem != Q_NULLPTR) {
QJsonArray chatIdsJson { };
for (QtTdLibChat * otherChatItem : (* m_chatsList)) {
if (otherChatItem != chatItem && otherChatItem->get_isPinned ()) {
chatIdsJson.append (otherChatItem->get_id_asJSON ());
}
}
if (!chatItem->get_isPinned ()) {
chatIdsJson.append (chatItem->get_id_asJSON ());
}
send (QJsonObject {
{ "@type", "setPinnedChats" },
{ "chat_ids", chatIdsJson },
});
}
}
void QtTdLibGlobal::loadMoreMessages (QtTdLibChat * chatItem, const int count) {
if (chatItem != Q_NULLPTR && !chatItem->messagesModel.isEmpty () && count > 0) {
qWarning () << "LOAD MORE...";
......@@ -644,6 +662,10 @@ QString QtTdLibGlobal::stopRecordingAudio (void) {
}
}
void QtTdLibGlobal::removeRecording (const QString & path) {
QFile::remove (path);
}
void QtTdLibGlobal::onFrame (const QJsonObject & json) {
switch (QtTdLibEnums::objectTypeEnumFromJson (json)) {
case QtTdLibObjectType::UPDATE_AUTHORIZATION_STATE: {
......
......@@ -106,6 +106,7 @@ public:
Q_INVOKABLE void openChat (QtTdLibChat * chatItem);
Q_INVOKABLE void closeChat (QtTdLibChat * chatItem);
Q_INVOKABLE void markAllMessagesAsRead (QtTdLibChat * chatItem);
Q_INVOKABLE void togglePinChat (QtTdLibChat * chatItem);
Q_INVOKABLE void loadMoreMessages (QtTdLibChat * chatItem, const int count);
......@@ -124,6 +125,7 @@ public:
Q_INVOKABLE bool startRecordingAudio (void);
Q_INVOKABLE QString stopRecordingAudio (void);
Q_INVOKABLE void removeRecording (const QString & path);
signals:
void showChatRequested (const QString & chatId);
......
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