Merge pull request #60 from monich/stickers-as-images
Made "Stickers as images" feature optional
This commit is contained in:
commit
1b4f58060a
4 changed files with 39 additions and 8 deletions
|
@ -497,7 +497,6 @@ Page {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
webPagePreviewLoader.active = ( typeof display.content.web_page !== "undefined" );
|
webPagePreviewLoader.active = ( typeof display.content.web_page !== "undefined" );
|
||||||
imagePreviewLoader.active = ( display.content['@type'] === "messagePhoto" );
|
imagePreviewLoader.active = ( display.content['@type'] === "messagePhoto" );
|
||||||
stickerPreviewLoader.active = ( display.content['@type'] === "messageSticker" );
|
|
||||||
videoPreviewLoader.active = (( display.content['@type'] === "messageVideo" ) || ( display.content['@type'] === "messageAnimation" ));
|
videoPreviewLoader.active = (( display.content['@type'] === "messageVideo" ) || ( display.content['@type'] === "messageAnimation" ));
|
||||||
audioPreviewLoader.active = (( display.content['@type'] === "messageVoiceNote" ) || ( display.content['@type'] === "messageAudio" ));
|
audioPreviewLoader.active = (( display.content['@type'] === "messageVoiceNote" ) || ( display.content['@type'] === "messageAudio" ));
|
||||||
documentPreviewLoader.active = ( display.content['@type'] === "messageDocument" );
|
documentPreviewLoader.active = ( display.content['@type'] === "messageDocument" );
|
||||||
|
@ -560,6 +559,7 @@ Page {
|
||||||
color: index > ( chatView.count - chatInformation.unread_count - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
color: index > ( chatView.count - chatInformation.unread_count - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||||
radius: parent.width / 50
|
radius: parent.width / 50
|
||||||
opacity: index > ( chatView.count - chatInformation.unread_count - 1 ) ? 0.5 : 0.2
|
opacity: index > ( chatView.count - chatInformation.unread_count - 1 ) ? 0.5 : 0.2
|
||||||
|
visible: appSettings.showStickersAsImages || display.content['@type'] !== "messageSticker"
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
@ -740,18 +740,16 @@ Page {
|
||||||
Component {
|
Component {
|
||||||
id: stickerPreviewComponent
|
id: stickerPreviewComponent
|
||||||
StickerPreview {
|
StickerPreview {
|
||||||
id: messageStickerPreview
|
|
||||||
stickerData: ( display.content['@type'] === "messageSticker" ) ? display.content.sticker : ""
|
stickerData: ( display.content['@type'] === "messageSticker" ) ? display.content.sticker : ""
|
||||||
visible: display.content['@type'] === "messageSticker"
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: stickerPreviewLoader
|
id: stickerPreviewLoader
|
||||||
active: false
|
active: display.content['@type'] === "messageSticker"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
width: parent.width
|
x: (chatPage.myUserId === display.sender_user_id) ? (parent.width - width) : 0
|
||||||
|
width: (appSettings.showStickersAsImages || !item) ? parent.width : item.width
|
||||||
sourceComponent: stickerPreviewComponent
|
sourceComponent: stickerPreviewComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ Page {
|
||||||
Column {
|
Column {
|
||||||
id: column
|
id: column
|
||||||
width: settingsPage.width
|
width: settingsPage.width
|
||||||
spacing: Theme.paddingLarge
|
|
||||||
|
|
||||||
PageHeader {
|
PageHeader {
|
||||||
title: qsTr("Settings")
|
title: qsTr("Settings")
|
||||||
|
@ -53,8 +52,22 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VerticalScrollDecorator {}
|
SectionHeader {
|
||||||
|
text: qsTr("Appearance")
|
||||||
|
}
|
||||||
|
|
||||||
|
TextSwitch {
|
||||||
|
checked: appSettings.showStickersAsImages
|
||||||
|
text: qsTr("Show stickers as images")
|
||||||
|
description: qsTr("Show background for stickers and align them centrally like images")
|
||||||
|
automaticCheck: false
|
||||||
|
onClicked: {
|
||||||
|
appSettings.showStickersAsImages = !checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VerticalScrollDecorator {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const QString KEY_SEND_BY_ENTER("sendByEnter");
|
const QString KEY_SEND_BY_ENTER("sendByEnter");
|
||||||
|
const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages");
|
||||||
}
|
}
|
||||||
|
|
||||||
AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings")
|
AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings")
|
||||||
|
@ -41,3 +42,17 @@ void AppSettings::setSendByEnter(bool sendByEnter)
|
||||||
emit sendByEnterChanged();
|
emit sendByEnterChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AppSettings::showStickersAsImages() const
|
||||||
|
{
|
||||||
|
return settings.value(KEY_SHOW_STICKERS_AS_IMAGES, true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppSettings::setShowStickersAsImages(bool showAsImages)
|
||||||
|
{
|
||||||
|
if (showStickersAsImages() != showAsImages) {
|
||||||
|
LOG(KEY_SHOW_STICKERS_AS_IMAGES << showAsImages);
|
||||||
|
settings.setValue(KEY_SHOW_STICKERS_AS_IMAGES, showAsImages);
|
||||||
|
emit showStickersAsImagesChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
class AppSettings : public QObject {
|
class AppSettings : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool sendByEnter READ getSendByEnter WRITE setSendByEnter NOTIFY sendByEnterChanged)
|
Q_PROPERTY(bool sendByEnter READ getSendByEnter WRITE setSendByEnter NOTIFY sendByEnterChanged)
|
||||||
|
Q_PROPERTY(bool showStickersAsImages READ showStickersAsImages WRITE setShowStickersAsImages NOTIFY showStickersAsImagesChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AppSettings(QObject *parent = Q_NULLPTR);
|
AppSettings(QObject *parent = Q_NULLPTR);
|
||||||
|
@ -31,8 +32,12 @@ public:
|
||||||
bool getSendByEnter() const;
|
bool getSendByEnter() const;
|
||||||
void setSendByEnter(bool sendByEnter);
|
void setSendByEnter(bool sendByEnter);
|
||||||
|
|
||||||
|
bool showStickersAsImages() const;
|
||||||
|
void setShowStickersAsImages(bool showAsImages);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendByEnterChanged();
|
void sendByEnterChanged();
|
||||||
|
void showStickersAsImagesChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
Loading…
Reference in a new issue