Merge pull request #1 from Wunderfitz/master
Syncing my fork to the original repository
This commit is contained in:
commit
6aef4da90c
23 changed files with 525 additions and 17 deletions
|
@ -14,9 +14,11 @@ Fernschreiber wouldn't be the same without all the people helping in making it b
|
|||
|
||||
### Translations
|
||||
- Chinese: [dashinfantry](https://github.com/dashinfantry)
|
||||
- Finnish: [jorm1s](https://github.com/jorm1s)
|
||||
- Hungarian [edp17](https://github.com/edp17)
|
||||
- Italian [Matteo](https://github.com/iamnomeutente)
|
||||
- Polish: [atlochowski](https://github.com/atlochowski)
|
||||
- Russian: [Rustem Abzalov](https://github.com/arustg)
|
||||
- Russian: [Rustem Abzalov](https://github.com/arustg) and [Slava Monich](https://github.com/monich)
|
||||
- Spanish: [GNUuser](https://github.com/GNUuser)
|
||||
|
||||
## License
|
||||
|
|
|
@ -27,6 +27,7 @@ SOURCES += src/harbour-fernschreiber.cpp \
|
|||
src/fernschreiberutils.cpp \
|
||||
src/notificationmanager.cpp \
|
||||
src/processlauncher.cpp \
|
||||
src/stickermanager.cpp \
|
||||
src/tdlibreceiver.cpp \
|
||||
src/tdlibwrapper.cpp
|
||||
|
||||
|
@ -36,6 +37,7 @@ DISTFILES += qml/harbour-fernschreiber.qml \
|
|||
qml/components/ImagePreview.qml \
|
||||
qml/components/InReplyToRow.qml \
|
||||
qml/components/LocationPreview.qml \
|
||||
qml/components/StickerPicker.qml \
|
||||
qml/components/WebPagePreview.qml \
|
||||
qml/js/functions.js \
|
||||
qml/pages/ChatPage.qml \
|
||||
|
@ -57,6 +59,7 @@ TRANSLATIONS += translations/harbour-fernschreiber-de.ts \
|
|||
translations/harbour-fernschreiber-es.ts \
|
||||
translations/harbour-fernschreiber-fi.ts \
|
||||
translations/harbour-fernschreiber-hu.ts \
|
||||
translations/harbour-fernschreiber-it.ts \
|
||||
translations/harbour-fernschreiber-pl.ts \
|
||||
translations/harbour-fernschreiber-ru.ts \
|
||||
translations/harbour-fernschreiber-zh_CN.ts
|
||||
|
@ -111,6 +114,7 @@ HEADERS += \
|
|||
src/fernschreiberutils.h \
|
||||
src/notificationmanager.h \
|
||||
src/processlauncher.h \
|
||||
src/stickermanager.h \
|
||||
src/tdlibreceiver.h \
|
||||
src/tdlibsecrets.h \
|
||||
src/tdlibwrapper.h
|
||||
|
|
|
@ -27,6 +27,7 @@ Row {
|
|||
id: inReplyToRow
|
||||
spacing: Theme.paddingSmall
|
||||
width: parent.width
|
||||
height: inReplyToMessageColumn.height
|
||||
|
||||
property string myUserId;
|
||||
property variant inReplyToMessage;
|
||||
|
|
186
qml/components/StickerPicker.qml
Normal file
186
qml/components/StickerPicker.qml
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
Copyright (C) 2020 Sebastian J. Wolf
|
||||
|
||||
This file is part of Fernschreiber.
|
||||
|
||||
Fernschreiber is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Fernschreiber is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import QtQuick 2.5
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtMultimedia 5.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../components"
|
||||
import "../js/twemoji.js" as Emoji
|
||||
|
||||
Item {
|
||||
id: stickerPickerOverlayItem
|
||||
anchors.fill: parent
|
||||
|
||||
property variant recentStickers: stickerManager.getRecentStickers()
|
||||
property variant installedStickerSets: stickerManager.getInstalledStickerSets()
|
||||
|
||||
Rectangle {
|
||||
id: stickerPickerOverlayBackground
|
||||
anchors.fill: parent
|
||||
|
||||
color: Theme.overlayBackgroundColor
|
||||
opacity: 0.7
|
||||
}
|
||||
Flickable {
|
||||
id: stickerPickerFlickable
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.paddingMedium
|
||||
contentHeight: stickerPickerColumn.height
|
||||
clip: true
|
||||
|
||||
Column {
|
||||
id: stickerPickerColumn
|
||||
spacing: Theme.paddingMedium
|
||||
width: stickerPickerFlickable.width
|
||||
Text {
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.bold: true
|
||||
color: Theme.primaryColor
|
||||
width: parent.width
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
text: qsTr("Recently used")
|
||||
}
|
||||
Flickable {
|
||||
width: parent.width
|
||||
height: recentStickersRow.height + Theme.paddingSmall
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
contentWidth: recentStickersRow.width
|
||||
clip: true
|
||||
|
||||
Row {
|
||||
id: recentStickersRow
|
||||
spacing: Theme.paddingMedium
|
||||
Repeater {
|
||||
model: stickerPickerOverlayItem.recentStickers
|
||||
|
||||
Item {
|
||||
height: singleRecentStickerRow.height
|
||||
width: singleRecentStickerRow.width
|
||||
|
||||
Row {
|
||||
id: singleRecentStickerRow
|
||||
spacing: Theme.paddingSmall
|
||||
Image {
|
||||
source: modelData.sticker.local.path
|
||||
width: Theme.itemSizeMedium
|
||||
height: Theme.itemSizeMedium
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
tdLibWrapper.sendStickerMessage(chatInformation.id, modelData.sticker.local.path);
|
||||
stickerPickerOverlayItem.visible = false;
|
||||
attachmentOptionsRow.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
model: stickerPickerOverlayItem.installedStickerSets
|
||||
width: stickerPickerFlickable.width
|
||||
Column {
|
||||
spacing: Theme.paddingMedium
|
||||
width: parent.width
|
||||
Text {
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.bold: true
|
||||
color: Theme.primaryColor
|
||||
width: parent.width
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
text: modelData.title
|
||||
}
|
||||
Flickable {
|
||||
width: parent.width
|
||||
height: installedStickerSetRow.height + Theme.paddingSmall
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
contentWidth: installedStickerSetRow.width
|
||||
clip: true
|
||||
Row {
|
||||
id: installedStickerSetRow
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
Repeater {
|
||||
model: modelData.stickers
|
||||
|
||||
Item {
|
||||
width: Theme.itemSizeMedium
|
||||
height: Theme.itemSizeMedium
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!modelData.sticker.local.is_downloading_completed) {
|
||||
tdLibWrapper.downloadFile(modelData.sticker.id);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: tdLibWrapper
|
||||
onFileUpdated : {
|
||||
if (fileInformation.local.is_downloading_completed) {
|
||||
if (fileId === modelData.sticker.id) {
|
||||
singleStickerImage.source = fileInformation.local.path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: singleStickerImage
|
||||
source: modelData.sticker.local.is_downloading_completed ? modelData.sticker.local.path : ""
|
||||
anchors.fill: parent
|
||||
visible: modelData.sticker.local.is_downloading_completed
|
||||
}
|
||||
Text {
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.primaryColor
|
||||
anchors.fill: parent
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
text: Emoji.emojify(modelData.emoji, font.pixelSize)
|
||||
visible: !modelData.sticker.local.is_downloading_completed
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
tdLibWrapper.sendStickerMessage(chatInformation.id, modelData.sticker.local.path);
|
||||
stickerPickerOverlayItem.visible = false;
|
||||
attachmentOptionsRow.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -51,8 +51,7 @@ Page {
|
|||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
asynchronous: true
|
||||
width: aboutPage.isPortrait ? ( 1/2 * parent.width ) : ( 1/2 * parent.height )
|
||||
|
||||
width: (aboutPage.isPortrait ? aboutPage.width : aboutPage.height) / 2
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
|
@ -635,14 +635,14 @@ Page {
|
|||
if (display.forward_info.origin["@type"] === "messageForwardOriginChannel") {
|
||||
var otherChatInformation = tdLibWrapper.getChat(display.forward_info.origin.chat_id);
|
||||
forwardedThumbnail.photoData = (typeof otherChatInformation.photo !== "undefined") ? otherChatInformation.photo.small : "";
|
||||
forwardedChannelText.text = otherChatInformation.title;
|
||||
forwardedChannelText.text = Emoji.emojify(otherChatInformation.title, Theme.fontSizeExtraSmall);
|
||||
} else if (display.forward_info.origin["@type"] === "messageForwardOriginUser") {
|
||||
var otherUserInformation = tdLibWrapper.getUserInformation(display.forward_info.origin.sender_user_id);
|
||||
forwardedThumbnail.photoData = (typeof otherUserInformation.profile_photo !== "undefined") ? otherUserInformation.profile_photo.small : "";
|
||||
forwardedChannelText.text = Functions.getUserName(otherUserInformation);
|
||||
forwardedChannelText.text = Emoji.emojify(Functions.getUserName(otherUserInformation), Theme.fontSizeExtraSmall);
|
||||
} else {
|
||||
forwardedThumbnail.photoData = "";
|
||||
forwardedChannelText.text = display.forward_info.origin.sender_user_name;
|
||||
forwardedChannelText.text = Emoji.emojify(display.forward_info.origin.sender_user_name, Theme.fontSizeExtraSmall);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ Page {
|
|||
font.bold: true
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.StyledText
|
||||
text: forwardedMessageInformationRow.otherChatInformation.title
|
||||
text: Emoji.emojify(forwardedMessageInformationRow.otherChatInformation.title, font.pixelSize)
|
||||
onTruncatedChanged: {
|
||||
// There is obviously a bug in QML in truncating text with images.
|
||||
// We simply remove Emojis then...
|
||||
|
@ -718,12 +718,17 @@ Page {
|
|||
active: false
|
||||
asynchronous: true
|
||||
width: parent.width
|
||||
height: messageListItem.containsWebPage ? ( item ? item.height : ( (parent.width * 2 / 3) + (6 * Theme.fontSizeExtraSmall) + ( 7 * Theme.paddingSmall) ) ) : 0
|
||||
height: messageListItem.containsWebPage ? ( (parent.width * 2 / 3) + (6 * Theme.fontSizeExtraSmall) + ( 7 * Theme.paddingSmall) ) : 0
|
||||
|
||||
sourceComponent: Component {
|
||||
id: webPagePreviewComponent
|
||||
WebPagePreview {
|
||||
id: webPagePreview
|
||||
|
||||
onImplicitHeightChanged: {
|
||||
webPagePreviewLoader.height = webPagePreview.implicitHeight;
|
||||
}
|
||||
|
||||
webPageData: messageListItem.containsWebPage ? display.content.web_page : ""
|
||||
width: parent.width
|
||||
}
|
||||
|
@ -939,6 +944,11 @@ Page {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// StickerPicker {
|
||||
// id: stickerPicker
|
||||
// visible: false
|
||||
// }
|
||||
}
|
||||
|
||||
Column {
|
||||
|
@ -1038,11 +1048,20 @@ Page {
|
|||
pageStack.push(documentPickerPage);
|
||||
}
|
||||
}
|
||||
IconButton {
|
||||
id: stickerAttachmentButton
|
||||
icon.source: "../../images/icon-m-sticker.png"
|
||||
onClicked: {
|
||||
// TODO
|
||||
HighlightImage {
|
||||
source: "../../images/icon-m-sticker.png"
|
||||
width: documentAttachmentButton.width
|
||||
height: documentAttachmentButton.height
|
||||
color: Theme.primaryColor
|
||||
highlightColor: Theme.highlightColor
|
||||
highlighted: stickerPicker.visible
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
//console.log("RECENT STICKERS: " + JSON.stringify(stickerManager.getRecentStickers()));
|
||||
//console.log("INSTALLED SETS: " + JSON.stringify(stickerManager.getInstalledStickerSets()));
|
||||
stickerPicker.visible = !stickerPicker.visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1179,7 +1198,7 @@ Page {
|
|||
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: Theme.paddingSmall
|
||||
enabled: !attachmentPreviewRow.visible
|
||||
enabled: !(attachmentPreviewRow.visible || stickerPicker.visible)
|
||||
onClicked: {
|
||||
if (attachmentOptionsRow.visible) {
|
||||
attachmentOptionsRow.visible = false;
|
||||
|
|
|
@ -94,6 +94,8 @@ Page {
|
|||
|
||||
function updateContent() {
|
||||
tdLibWrapper.getChats();
|
||||
tdLibWrapper.getRecentStickers();
|
||||
tdLibWrapper.getInstalledStickerSets();
|
||||
}
|
||||
|
||||
function initializePage() {
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "notificationmanager.h"
|
||||
#include "dbusadaptor.h"
|
||||
#include "processlauncher.h"
|
||||
#include "stickermanager.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -66,6 +67,9 @@ int main(int argc, char *argv[])
|
|||
ProcessLauncher processLauncher;
|
||||
context->setContextProperty("processLauncher", &processLauncher);
|
||||
|
||||
StickerManager stickerManager(tdLibWrapper);
|
||||
context->setContextProperty("stickerManager", &stickerManager);
|
||||
|
||||
view->setSource(SailfishApp::pathTo("qml/harbour-fernschreiber.qml"));
|
||||
view->show();
|
||||
return app->exec();
|
||||
|
|
110
src/stickermanager.cpp
Normal file
110
src/stickermanager.cpp
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
Copyright (C) 2020 Sebastian J. Wolf
|
||||
|
||||
This file is part of Fernschreiber.
|
||||
|
||||
Fernschreiber is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Fernschreiber is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stickermanager.h"
|
||||
#include <QDebug>
|
||||
#include <QListIterator>
|
||||
|
||||
#define LOG(x) qDebug() << "[StickerManager]" << x
|
||||
|
||||
StickerManager::StickerManager(TDLibWrapper *tdLibWrapper, QObject *parent) : QObject(parent)
|
||||
{
|
||||
LOG("Initializing...");
|
||||
this->tdLibWrapper = tdLibWrapper;
|
||||
|
||||
connect(this->tdLibWrapper, SIGNAL(recentStickersUpdated(QVariantList)), this, SLOT(handleRecentStickersUpdated(QVariantList)));
|
||||
connect(this->tdLibWrapper, SIGNAL(stickersReceived(QVariantList)), this, SLOT(handleStickersReceived(QVariantList)));
|
||||
connect(this->tdLibWrapper, SIGNAL(installedStickerSetsUpdated(QVariantList)), this, SLOT(handleInstalledStickerSetsUpdated(QVariantList)));
|
||||
connect(this->tdLibWrapper, SIGNAL(stickerSetsReceived(QVariantList)), this, SLOT(handleStickerSetsReceived(QVariantList)));
|
||||
connect(this->tdLibWrapper, SIGNAL(stickerSetReceived(QVariantMap)), this, SLOT(handleStickerSetReceived(QVariantMap)));
|
||||
}
|
||||
|
||||
StickerManager::~StickerManager()
|
||||
{
|
||||
LOG("Destroying myself...");
|
||||
}
|
||||
|
||||
QVariantList StickerManager::getRecentStickers()
|
||||
{
|
||||
return this->recentStickers;
|
||||
}
|
||||
|
||||
QVariantList StickerManager::getInstalledStickerSets()
|
||||
{
|
||||
return this->installedStickerSets;
|
||||
}
|
||||
|
||||
void StickerManager::handleRecentStickersUpdated(const QVariantList &stickerIds)
|
||||
{
|
||||
LOG("Receiving recent stickers...." << stickerIds);
|
||||
this->recentStickerIds = stickerIds;
|
||||
}
|
||||
|
||||
void StickerManager::handleStickersReceived(const QVariantList &stickers)
|
||||
{
|
||||
LOG("Receiving stickers...." << stickers);
|
||||
QListIterator<QVariant> stickersIterator(stickers);
|
||||
while (stickersIterator.hasNext()) {
|
||||
QVariantMap newSticker = stickersIterator.next().toMap();
|
||||
this->stickers.insert(newSticker.value("sticker").toMap().value("id").toString(), newSticker);
|
||||
}
|
||||
|
||||
this->recentStickers.clear();
|
||||
QListIterator<QVariant> stickerIdIterator(this->recentStickerIds);
|
||||
while (stickerIdIterator.hasNext()) {
|
||||
QString stickerId = stickerIdIterator.next().toString();
|
||||
this->recentStickers.append(this->stickers.value(stickerId));
|
||||
}
|
||||
}
|
||||
|
||||
void StickerManager::handleInstalledStickerSetsUpdated(const QVariantList &stickerSetIds)
|
||||
{
|
||||
LOG("Receiving installed sticker IDs...." << stickerSetIds);
|
||||
this->installedStickerSetIds = stickerSetIds;
|
||||
}
|
||||
|
||||
void StickerManager::handleStickerSetsReceived(const QVariantList &stickerSets)
|
||||
{
|
||||
LOG("Receiving sticker sets...." << stickerSets);
|
||||
QListIterator<QVariant> stickerSetsIterator(stickerSets);
|
||||
while (stickerSetsIterator.hasNext()) {
|
||||
QVariantMap newStickerSet = stickerSetsIterator.next().toMap();
|
||||
this->stickerSets.insert(newStickerSet.value("id").toString(), newStickerSet);
|
||||
}
|
||||
|
||||
this->installedStickerSets.clear();
|
||||
QListIterator<QVariant> stickerSetIdIterator(this->installedStickerSetIds);
|
||||
int i = 0;
|
||||
this->stickerSetMap.clear();
|
||||
while (stickerSetIdIterator.hasNext()) {
|
||||
QString stickerSetId = stickerSetIdIterator.next().toString();
|
||||
this->installedStickerSets.append(this->stickerSets.value(stickerSetId));
|
||||
this->stickerSetMap.insert(stickerSetId, i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void StickerManager::handleStickerSetReceived(const QVariantMap &stickerSet)
|
||||
{
|
||||
LOG("Receiving complete sticker set...." << stickerSet);
|
||||
QString stickerSetId = stickerSet.value("id").toString();
|
||||
this->stickerSets.insert(stickerSetId, stickerSet);
|
||||
int setIndex = this->stickerSetMap.value(stickerSetId).toInt();
|
||||
this->installedStickerSets.replace(setIndex, stickerSet);
|
||||
}
|
63
src/stickermanager.h
Normal file
63
src/stickermanager.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
Copyright (C) 2020 Sebastian J. Wolf
|
||||
|
||||
This file is part of Fernschreiber.
|
||||
|
||||
Fernschreiber is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Fernschreiber is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef STICKERMANAGER_H
|
||||
#define STICKERMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
#include <QVariantList>
|
||||
|
||||
#include "tdlibwrapper.h"
|
||||
|
||||
class StickerManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit StickerManager(TDLibWrapper *tdLibWrapper, QObject *parent = nullptr);
|
||||
~StickerManager();
|
||||
|
||||
Q_INVOKABLE QVariantList getRecentStickers();
|
||||
Q_INVOKABLE QVariantList getInstalledStickerSets();
|
||||
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
|
||||
void handleRecentStickersUpdated(const QVariantList &stickerIds);
|
||||
void handleStickersReceived(const QVariantList &stickers);
|
||||
void handleInstalledStickerSetsUpdated(const QVariantList &stickerSetIds);
|
||||
void handleStickerSetsReceived(const QVariantList &stickerSets);
|
||||
void handleStickerSetReceived(const QVariantMap &stickerSet);
|
||||
|
||||
private:
|
||||
|
||||
TDLibWrapper *tdLibWrapper;
|
||||
|
||||
QVariantList recentStickers;
|
||||
QVariantList recentStickerIds;
|
||||
QVariantList installedStickerSets;
|
||||
QVariantList installedStickerSetIds;
|
||||
QVariantMap stickers;
|
||||
QVariantMap stickerSets;
|
||||
QVariantMap stickerSetMap;
|
||||
|
||||
};
|
||||
|
||||
#endif // STICKERMANAGER_H
|
|
@ -103,6 +103,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
|
|||
handlers.insert("stickers", &TDLibReceiver::processStickers);
|
||||
handlers.insert("updateInstalledStickerSets", &TDLibReceiver::processUpdateInstalledStickerSets);
|
||||
handlers.insert("stickerSets", &TDLibReceiver::processStickerSets);
|
||||
handlers.insert("stickerSet", &TDLibReceiver::processStickerSet);
|
||||
}
|
||||
|
||||
void TDLibReceiver::setActive(const bool &active)
|
||||
|
@ -395,5 +396,11 @@ void TDLibReceiver::processUpdateInstalledStickerSets(const QVariantMap &receive
|
|||
void TDLibReceiver::processStickerSets(const QVariantMap &receivedInformation)
|
||||
{
|
||||
LOG("Received some sticker sets...");
|
||||
emit stickers(receivedInformation.value("sets").toList());
|
||||
emit stickerSets(receivedInformation.value("sets").toList());
|
||||
}
|
||||
|
||||
void TDLibReceiver::processStickerSet(const QVariantMap &receivedInformation)
|
||||
{
|
||||
LOG("Received a sticker set...");
|
||||
emit stickerSet(receivedInformation);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ signals:
|
|||
void stickers(const QVariantList &stickers);
|
||||
void installedStickerSetsUpdated(const QVariantList &stickerSetIds);
|
||||
void stickerSets(const QVariantList &stickerSets);
|
||||
void stickerSet(const QVariantMap &stickerSet);
|
||||
|
||||
private:
|
||||
typedef void (TDLibReceiver::*Handler)(const QVariantMap &);
|
||||
|
@ -111,6 +112,7 @@ private:
|
|||
void processStickers(const QVariantMap &receivedInformation);
|
||||
void processUpdateInstalledStickerSets(const QVariantMap &receivedInformation);
|
||||
void processStickerSets(const QVariantMap &receivedInformation);
|
||||
void processStickerSet(const QVariantMap &receivedInformation);
|
||||
};
|
||||
|
||||
#endif // TDLIBRECEIVER_H
|
||||
|
|
|
@ -91,6 +91,7 @@ TDLibWrapper::TDLibWrapper(QObject *parent) : QObject(parent)
|
|||
connect(this->tdLibReceiver, SIGNAL(stickers(QVariantList)), this, SLOT(handleStickers(QVariantList)));
|
||||
connect(this->tdLibReceiver, SIGNAL(installedStickerSetsUpdated(QVariantList)), this, SLOT(handleInstalledStickerSetsUpdated(QVariantList)));
|
||||
connect(this->tdLibReceiver, SIGNAL(stickerSets(QVariantList)), this, SLOT(handleStickerSets(QVariantList)));
|
||||
connect(this->tdLibReceiver, SIGNAL(stickerSet(QVariantMap)), this, SLOT(handleStickerSet(QVariantMap)));
|
||||
|
||||
this->tdLibReceiver->start();
|
||||
|
||||
|
@ -336,6 +337,28 @@ void TDLibWrapper::sendDocumentMessage(const QString &chatId, const QString &fil
|
|||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &filePath, const QString &replyToMessageId)
|
||||
{
|
||||
LOG("Sending sticker message" << chatId << filePath << replyToMessageId);
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert(_TYPE, "sendMessage");
|
||||
requestObject.insert("chat_id", chatId);
|
||||
if (replyToMessageId != "0") {
|
||||
requestObject.insert("reply_to_message_id", replyToMessageId);
|
||||
}
|
||||
QVariantMap inputMessageContent;
|
||||
inputMessageContent.insert(_TYPE, "inputMessageSticker");
|
||||
|
||||
QVariantMap stickerInputFile;
|
||||
stickerInputFile.insert(_TYPE, "inputFileLocal");
|
||||
stickerInputFile.insert("path", filePath);
|
||||
|
||||
inputMessageContent.insert("sticker", stickerInputFile);
|
||||
|
||||
requestObject.insert("input_message_content", inputMessageContent);
|
||||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::getMessage(const QString &chatId, const QString &messageId)
|
||||
{
|
||||
LOG("Retrieving message" << chatId << messageId);
|
||||
|
@ -435,6 +458,15 @@ void TDLibWrapper::getInstalledStickerSets()
|
|||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::getStickerSet(const QString &setId)
|
||||
{
|
||||
LOG("Retrieving sticker set" << setId);
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert(_TYPE, "getStickerSet");
|
||||
requestObject.insert("set_id", setId);
|
||||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
QVariantMap TDLibWrapper::getUserInformation()
|
||||
{
|
||||
return this->userInformation;
|
||||
|
@ -783,9 +815,19 @@ void TDLibWrapper::handleInstalledStickerSetsUpdated(const QVariantList &sticker
|
|||
|
||||
void TDLibWrapper::handleStickerSets(const QVariantList &stickerSets)
|
||||
{
|
||||
QListIterator<QVariant> stickerSetIterator(stickerSets);
|
||||
while (stickerSetIterator.hasNext()) {
|
||||
QVariantMap stickerSet = stickerSetIterator.next().toMap();
|
||||
this->getStickerSet(stickerSet.value("id").toString());
|
||||
}
|
||||
emit this->stickerSetsReceived(stickerSets);
|
||||
}
|
||||
|
||||
void TDLibWrapper::handleStickerSet(const QVariantMap &stickerSet)
|
||||
{
|
||||
emit stickerSetReceived(stickerSet);
|
||||
}
|
||||
|
||||
void TDLibWrapper::setInitialParameters()
|
||||
{
|
||||
LOG("Sending initial parameters to TD Lib");
|
||||
|
|
|
@ -118,6 +118,7 @@ public:
|
|||
Q_INVOKABLE void sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
|
||||
Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
|
||||
Q_INVOKABLE void sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
|
||||
Q_INVOKABLE void sendStickerMessage(const QString &chatId, const QString &filePath, const QString &replyToMessageId = "0");
|
||||
Q_INVOKABLE void getMessage(const QString &chatId, const QString &messageId);
|
||||
Q_INVOKABLE void setOptionInteger(const QString &optionName, const int &optionValue);
|
||||
Q_INVOKABLE void setChatNotificationSettings(const QString &chatId, const QVariantMap ¬ificationSettings);
|
||||
|
@ -126,6 +127,7 @@ public:
|
|||
Q_INVOKABLE void getMapThumbnailFile(const QString &chatId, const double &latitude, const double &longitude, const int &width, const int &height);
|
||||
Q_INVOKABLE void getRecentStickers();
|
||||
Q_INVOKABLE void getInstalledStickerSets();
|
||||
Q_INVOKABLE void getStickerSet(const QString &setId);
|
||||
|
||||
public:
|
||||
const Group* getGroup(qlonglong groupId) const;
|
||||
|
@ -166,6 +168,7 @@ signals:
|
|||
void stickersReceived(const QVariantList &stickers);
|
||||
void installedStickerSetsUpdated(const QVariantList &stickerSetIds);
|
||||
void stickerSetsReceived(const QVariantList &stickerSets);
|
||||
void stickerSetReceived(const QVariantMap &stickerSet);
|
||||
|
||||
public slots:
|
||||
void handleVersionDetected(const QString &version);
|
||||
|
@ -200,6 +203,7 @@ public slots:
|
|||
void handleStickers(const QVariantList &stickers);
|
||||
void handleInstalledStickerSetsUpdated(const QVariantList &stickerSetIds);
|
||||
void handleStickerSets(const QVariantList &stickerSets);
|
||||
void handleStickerSet(const QVariantMap &stickerSet);
|
||||
|
||||
private:
|
||||
void setInitialParameters();
|
||||
|
|
|
@ -516,13 +516,20 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Show stickers as images</source>
|
||||
<translation">Sticker als Bilder anzeigen</translation>
|
||||
<translation>Sticker als Bilder anzeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show background for stickers and align them centrally like images</source>
|
||||
<translation>Hintergrund für Sticker anzeigen und sie wie Bilder mittig platzieren.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -523,6 +523,13 @@
|
|||
<translation>Mostrar fondo para pegatinas y alinearlas centralmente como imágenes</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -523,6 +523,13 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -523,6 +523,13 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -516,13 +516,20 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Show stickers as images</source>
|
||||
<translation">Mostra sticker come immagini</translation>
|
||||
<translation>Mostra sticker come immagini</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show background for stickers and align them centrally like images</source>
|
||||
<translation>Mostra sfondo per gli sticker e centrali come le immagini.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -523,6 +523,13 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -523,6 +523,13 @@
|
|||
<translation>То есть рисовать под ними фон и позиционировать по центру.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -523,6 +523,13 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
|
@ -523,6 +523,13 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StickerPicker</name>
|
||||
<message>
|
||||
<source>Recently used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
<message>
|
||||
|
|
Loading…
Reference in a new issue